/*
 * Base Styles - Samsung-Inspired Clean Design
 * Shared across all pages
 */

/* ===== CSS Variables ===== */
:root {
    --primary: #1428a0;
    --primary-light: #2962ff;
    --primary-gradient: linear-gradient(135deg, #1428a0, #2962ff);
    --accent-gradient: linear-gradient(135deg, #1428a0, #0d47a1);
    --success-gradient: linear-gradient(135deg, #00c853, #69f0ae);
    --danger-gradient: linear-gradient(135deg, #ff1744, #ff5252);
    --info-gradient: linear-gradient(135deg, #2979ff, #448aff);
    --warning-gradient: linear-gradient(135deg, #ff9100, #ffab40);

    --bg-page: #ffffff;
    --bg-card: #f4f4f4;
    --bg-card-hover: #eaeaea;
    --bg-dark: #000000;

    --glass-bg: #f4f4f4;
    --glass-bg-light: #f9f9f9;
    --glass-border: #e0e0e0;
    --glass-border-light: #eeeeee;
    --card-bg: #f4f4f4;

    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #666666;

    --color-success: #00c853;
    --color-success-light: #00c853;
    --color-danger: #ff1744;
    --color-danger-light: #ff1744;
    --color-info: #2979ff;
    --color-info-light: #2979ff;
    --color-warning: #ff9100;
    --color-warning-light: #ff9100;
    --color-purple: #7c4dff;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-pill: 50px;

    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);

    --transition: all 0.3s ease;
}


/* ===== Export Dialog ===== */
.export-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(8px);
    z-index: 5000; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.export-overlay.show { opacity: 1; pointer-events: all; }

.export-dialog {
    background: #ffffff;
    border-radius: var(--radius-2xl); padding: 32px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    max-width: 420px; width: 90%; text-align: center;
    transform: scale(0.9); transition: transform 0.3s;
}
.export-overlay.show .export-dialog { transform: scale(1); }

.export-dialog h3 { font-size: 1.4rem; margin-bottom: 20px; color: var(--text-primary); }

.export-option {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px; margin-bottom: 10px;
    background: var(--bg-card); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); cursor: pointer; color: var(--text-primary);
    transition: var(--transition); font-family: 'Cairo', sans-serif; font-size: 1rem;
    width: 100%; text-align: right;
}
.export-option:hover { background: var(--bg-card-hover); border-color: var(--primary); transform: translateY(-2px); }
.export-option .export-icon { font-size: 1.6rem; }
.export-option .export-label { flex: 1; }
.export-option .export-label small { display: block; font-size: 0.8rem; color: var(--text-secondary); }

.export-cancel {
    margin-top: 16px; padding: 10px 24px;
    background: #fff0f0; border: 1px solid #ffcdd2;
    border-radius: var(--radius-pill); color: var(--color-danger);
    cursor: pointer; font-family: 'Cairo', sans-serif; font-size: 0.9rem;
}
.export-cancel:hover { background: #ffcdd2; }

/* ===== Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== Base ===== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-page);
    min-height: 100vh;
    color: var(--text-primary);
    padding: 20px;
}

body.body-centered {
    display: flex;
    align-items: center;
    justify-content: center;
}

body.body-no-padding {
    padding: 0;
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

.container-sm { max-width: 900px; margin: 0 auto; }
.container-lg { max-width: 1400px; margin: 0 auto; }

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

.heading-gradient {
    color: var(--text-primary);
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

.heading-gold {
    color: var(--primary);
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

/* ===== Links ===== */
a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.animate-fadeIn { animation: fadeIn 0.5s ease-out; }
.animate-fadeInDown { animation: fadeInDown 0.8s ease-out; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--primary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }

.hidden { display: none; }

/* ===== Button Loading States ===== */
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

.btn-loading {
    opacity: 0.8;
    pointer-events: none;
}

/* ===== Sidebar Tooltips (collapsed) ===== */
.sidebar.collapsed .nav-item {
    position: relative;
}

.sidebar.collapsed .nav-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateX(-100%) translateY(-50%);
    background: #222;
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1100;
    box-shadow: var(--shadow-md);
    pointer-events: none;
    animation: fadeIn 0.15s ease-out;
}

/* ===== Sidebar Navigation ===== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 260px;
    height: 100vh;
    background: #000000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 72px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    color: #ffffff;
}

.sidebar-logo .logo-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-logo span:not(.logo-icon) {
    display: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar.collapsed .sidebar-toggle {
    margin: 0 auto;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(-4px);
}

.nav-item.active {
    background: rgba(20, 40, 160, 0.3);
    color: #82b1ff;
    border: 1px solid rgba(20, 40, 160, 0.4);
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    transition: var(--transition);
}

.nav-label {
    font-size: 0.92rem;
    font-weight: 600;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 12px 8px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.collapsed .sidebar-user .user-name {
    display: none;
}

/* Body offset for sidebar */
body.has-sidebar {
    padding-right: 272px;
}

body.has-sidebar.sidebar-collapsed {
    padding-right: 84px;
}

/* Hamburger (hidden on desktop) */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: #000000;
    border: none;
    color: #ffffff;
    font-size: 1.4rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.hamburger-btn:hover {
    background: #222;
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    body { padding: 12px; }
    body.has-sidebar { padding-right: 12px; padding-top: 60px; }
    body.has-sidebar.sidebar-collapsed { padding-right: 12px; }
    .container, .container-sm, .container-lg { padding: 0 8px; }
    h1 { font-size: 1.8rem; }

    .hamburger-btn { display: flex; }

    .sidebar {
        transform: translateX(100%);
        width: 280px;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: 280px;
    }
}

/* Contrast fixes — readable placeholders */
::placeholder { color: #999 !important; opacity: 1; }
input::placeholder, textarea::placeholder { color: #999 !important; }
