/* Global base styles */

/* ==================== Theme CSS Variables ==================== */
:root {
  /* Light Mode Colors (Default) */
  --bg-primary: #f6f6f6;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8f9fa;
  --bg-card: #ffffff;
  --bg-sidebar: #f8f9fa;
  --bg-input: #ffffff;
  --bg-hover: #f0f0f0;
  --bg-active: #e7f1ff;
  
  --text-primary: #0f0f0f;
  --text-secondary: #333333;
  --text-tertiary: #666666;
  --text-muted: #888888;
  --text-inverse: #ffffff;
  
  --border-primary: #e0e0e0;
  --border-secondary: #dee2e6;
  --border-light: #eeeeee;
  
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --shadow-heavy: rgba(0, 0, 0, 0.2);
  
  --accent-primary: #007bff;
  --accent-success: #28a745;
  --accent-warning: #ffc107;
  --accent-danger: #dc3545;
  --accent-info: #17a2b8;
  
  --modal-overlay: rgba(0, 0, 0, 0.5);
  --tooltip-bg: rgba(0, 0, 0, 0.7);
  
  /* Component specific */
  --menu-active-bg: #e7f1ff;
  --menu-active-color: #0066cc;
  --menu-hover-bg: #eef2f7;
  
  /* Leaderboard top 3 */
  --leaderboard-top3-bg: linear-gradient(135deg, #fff9e6, #ffffff);
  --leaderboard-top3-hover: linear-gradient(135deg, #fff4d6, #f8f9fa);
  
  /* Pixel canvas background */
  --pixel-canvas-bg: #ffffff;
  
  /* Chat leaderboard top 3 ranks */
  --chat-rank1-bg: linear-gradient(135deg, #ffebee, #fce4ec);
  --chat-rank1-border: #f8bbd9;
  --chat-rank2-bg: linear-gradient(135deg, #fff3e0, #ffe0b2);
  --chat-rank2-border: #ffcc80;
  --chat-rank3-bg: linear-gradient(135deg, #fffde7, #fff9c4);
  --chat-rank3-border: #fff176;
  
  /* Overlay background */
  --bg-overlay: rgba(255, 255, 255, 0.7);
  
  /* Alert colors */
  --alert-success-bg: #d4edda;
  --alert-success-text: #155724;
  --alert-success-border: #c3e6cb;
  --alert-error-bg: #f8d7da;
  --alert-error-text: #721c24;
  --alert-error-border: #f5c6cb;
  --alert-info-bg: #d1ecf1;
  --alert-info-text: #0c5460;
  --alert-info-border: #bee5eb;
  --alert-warning-bg: #fff3cd;
  --alert-warning-text: #856404;
  --alert-warning-border: #ffeaa7;
}

/* Dark Mode Colors */
[data-theme="dark"] {
  --bg-primary: #1a1a2e;
  --bg-secondary: #25253a;
  --bg-tertiary: #2d2d44;
  --bg-card: #25253a;
  --bg-sidebar: #1f1f33;
  --bg-input: #2d2d44;
  --bg-hover: #3d3d5c;
  --bg-active: #3d3d5c;
  
  --text-primary: #e8e8e8;
  --text-secondary: #d0d0d0;
  --text-tertiary: #a0a0a0;
  --text-muted: #888888;
  --text-inverse: #1a1a2e;
  
  --border-primary: #404060;
  --border-secondary: #505070;
  --border-light: #353550;
  
  --shadow-light: rgba(0, 0, 0, 0.3);
  --shadow-medium: rgba(0, 0, 0, 0.4);
  --shadow-heavy: rgba(0, 0, 0, 0.5);
  
  --accent-primary: #5b9cff;
  --accent-success: #4caf50;
  --accent-warning: #ffca28;
  --accent-danger: #ef5350;
  --accent-info: #29b6f6;
  
  --modal-overlay: rgba(0, 0, 0, 0.7);
  --tooltip-bg: rgba(40, 40, 60, 0.9);
  
  /* Component specific */
  --menu-active-bg: #3d3d5c;
  --menu-active-color: #5b9cff;
  --menu-hover-bg: #353550;
  
  /* Leaderboard top 3 */
  --leaderboard-top3-bg: linear-gradient(135deg, #3d3d5c, #35354a);
  --leaderboard-top3-hover: linear-gradient(135deg, #4d4d6c, #454558);
  
  /* Pixel canvas background - slightly dimmed white for dark mode */
  --pixel-canvas-bg: #d8d8d8;
  
  /* Chat leaderboard top 3 ranks - darker versions for dark mode */
  --chat-rank1-bg: linear-gradient(135deg, #4a3540, #3d2d35);
  --chat-rank1-border: #e91e63;
  --chat-rank2-bg: linear-gradient(135deg, #4a4035, #3d352d);
  --chat-rank2-border: #ff9800;
  --chat-rank3-bg: linear-gradient(135deg, #4a4a35, #3d3d2d);
  --chat-rank3-border: #ffeb3b;
  
  /* Overlay background */
  --bg-overlay: rgba(0, 0, 0, 0.3);
  
  /* Alert colors - darker versions for dark mode */
  --alert-success-bg: #1e3a2f;
  --alert-success-text: #75d9a3;
  --alert-success-border: #2d5a45;
  --alert-error-bg: #3a1e1e;
  --alert-error-text: #f5a5a5;
  --alert-error-border: #5a2d2d;
  --alert-info-bg: #1e2f3a;
  --alert-info-text: #7ec8e3;
  --alert-info-border: #2d455a;
  --alert-warning-bg: #3a351e;
  --alert-warning-text: #f5d98a;
  --alert-warning-border: #5a4d2d;
}

:root, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container for centering login components */
.container {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease;
}

/* Prevent modal scroll issues */
body.modal-open {
  overflow: hidden;
}

/* ==================== public pagination styles ==================== */
/* Pagination styles - public styles, used by all pages */
.pagination-top,
.pagination-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.pagination-top {
    margin-bottom: 20px;
}

.pagination-bottom {
    margin-top: 30px;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-secondary);
}

.pagination-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.pagination-info {
    margin: 0 15px;
    font-size: 0.9em;
    color: var(--text-tertiary);
}

/* Page number buttons */
.page-numbers {
    display: flex;
    gap: 5px;
    margin: 0 10px;
}

.page-number-btn {
    padding: 6px 10px;
    border: 1px solid var(--border-primary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.page-number-btn.current {
    background: var(--accent-primary);
    color: var(--text-inverse);
    border-color: var(--accent-primary);
}

.page-number-btn:hover:not(.current) {
    background: var(--bg-hover);
    border-color: var(--border-secondary);
}

/* 分页响应式设计 */
@media (max-width: 480px) {
    .pagination-top,
    .pagination-bottom {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .pagination-info {
        margin: 0 8px;
        font-size: 0.8em;
    }
    
    .pagination-btn {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .page-number-btn {
        padding: 5px 8px;
        font-size: 13px;
    }
}

/* ==================== public refresh button styles ==================== */
/* Refresh button - public styles, used by all pages */
.refresh-btn {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.refresh-btn:hover:not(:disabled) {
    background: #218838;
}

.refresh-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Refresh button responsive design */
@media (max-width: 480px) {
    .refresh-btn {
        font-size: 14px;
        padding: 6px 12px;
    }
}

/* ==================== public loading and empty state styles ==================== */
/* Loading state - public styles */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-tertiary);
    margin: 0;
}

/* Empty state - public styles */
.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    text-align: center;
}

.empty-message {
    color: var(--text-muted);
    font-style: italic;
}

/* Records container - public styles */
.records-container {
    margin-top: 2rem;
}

/* ==================== public error handling styles ==================== */
/* Error container and messages - public styles */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.error-message {
    color: var(--accent-danger);
    margin-bottom: 1rem;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 0;
}

.error-message.success {
    color: var(--accent-success);
    background-color: rgba(40, 167, 69, 0.15);
    border: 1px solid var(--accent-success);
}

.error-message.warning {
    color: #856404;
    background-color: rgba(255, 193, 7, 0.15);
    border: 1px solid var(--accent-warning);
}

[data-theme="dark"] .error-message.warning {
    color: var(--accent-warning);
}

.error-message.error {
    color: #721c24;
    background-color: rgba(220, 53, 69, 0.15);
    border: 1px solid var(--accent-danger);
}

[data-theme="dark"] .error-message.error {
    color: var(--accent-danger);
}

.error-message:not(:empty) {
    display: block;
    margin-bottom: 1rem;
}

.error-message:empty {
    display: none;
}

.retry-button {
    background-color: var(--accent-primary);
    color: var(--text-inverse);
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.retry-button:hover {
    background-color: #0056b3;
}

[data-theme="dark"] .retry-button:hover {
    background-color: #4a8ae0;
}

/* ==================== public warning messages styles ==================== */
/* No-profile warning - public styles */
.no-profile-warning {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid var(--accent-warning);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-theme="dark"] .no-profile-warning {
    color: var(--accent-warning);
}

.no-profile-warning p {
    margin: 0;
    font-size: 14px;
}

/* ==================== public memo cards container styles ==================== */
/* Memo cards container - public styles */
.memo-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 16px;
    margin-top: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .memo-cards {
        justify-content: center;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .memo-cards {
        gap: 8px;
    }
}

/* ==================== public header section styles ==================== */
/* Header section - public styles */
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-section h2 {
    color: var(--text-secondary);
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* header section responsive design */
@media (max-width: 480px) {
    .header-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .header-section h2 {
        font-size: 1.5rem;
    }
    
    .refresh-btn {
        align-self: flex-end;
    }
}

/* ==================== global modal styles ==================== */
/* Modal styles - public styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    box-shadow: 0 4px 20px var(--shadow-medium);
    border: 1px solid var(--border-primary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.modal-body {
    padding: 20px 24px;
}

/* ==================== Theme Toggle Button Styles ==================== */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.theme-toggle-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-secondary);
    transform: translateY(-1px);
}

.theme-toggle-btn:active {
    transform: translateY(0);
}

.theme-toggle-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.theme-toggle-btn:hover i {
    transform: rotate(15deg);
}

/* Sun icon for light mode */
.theme-toggle-btn .fa-sun {
    color: #f39c12;
}

/* Moon icon for dark mode */
.theme-toggle-btn .fa-moon {
    color: #9b59b6;
}

[data-theme="dark"] .theme-toggle-btn .fa-sun {
    color: #f1c40f;
}

/* Mobile responsive - hide text on small screens */
@media (max-width: 480px) {
    .theme-toggle-btn span {
        display: none;
    }
    
    .theme-toggle-btn {
        padding: 8px 12px;
    }
} 