/* === iDev Design System Applied to ESS === */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

/* === CSS Custom Properties === */
:root {
    /* Brand */
    --accent: #fd7448;
    --accent-hover: #eb633d;
    --accent-soft: rgba(253, 116, 72, 0.12);
    --accent-glow: rgba(253, 116, 72, 0.38);
    /* Radius */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-xl: 30px;
    --radius-pill: 999px;
    /* Shadows */
    --shadow-card: 0 16px 48px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-accent: 0 8px 24px rgba(253, 116, 72, 0.35);
    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* Dark theme (default) */
:root, [data-theme="dark"] {
    --bg: #1a191e;
    --surface: #2b2b2b;
    --surface-2: #333333;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text: #fefefe;
    --text-muted: rgba(255, 255, 255, 0.65);
    --text-subtle: rgba(255, 255, 255, 0.45);
    --header-bg: rgba(0, 0, 0, 0.88);
    /* Legacy aliases */
    --dark-bg: var(--bg);
    --card-bg: var(--surface);
    --card-elevated: var(--surface-2);
    --text-primary: var(--text);
    --text-dim: var(--text-subtle);
    --accent-border: rgba(253, 116, 72, 0.25);
    --divider: rgba(255, 255, 255, 0.06);
}

/* Light theme */
[data-theme="light"] {
    --bg: #ffffff;
    --surface: #f5f5f5;
    --surface-2: #ebebeb;
    --border: #e5e5e5;
    --border-hover: #d0d0d0;
    --text: #111111;
    --text-muted: #666666;
    --text-subtle: #999999;
    --header-bg: rgba(255, 255, 255, 0.92);
    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    /* Legacy aliases */
    --dark-bg: var(--bg);
    --card-bg: var(--surface);
    --card-elevated: var(--surface-2);
    --text-primary: var(--text);
    --text-dim: var(--text-subtle);
    --accent-border: rgba(253, 116, 72, 0.25);
    --divider: #e5e5e5;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: "Montserrat", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* === Layout === */
.main-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    max-width: min(1200px, calc(100% - 48px));
    margin: 0 auto;
    padding: 0 0 60px;
    flex: 1;
}

/* === Header (floating pill) === */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 16px 20px;
    background: transparent;
    margin-bottom: 32px;
}

.header-shell {
    max-width: min(1200px, calc(100% - 8px));
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    padding: 14px 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.logo {
    color: var(--accent);
    text-decoration: none;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-img {
    height: 28px;
    filter: brightness(0) invert(1);
}

.logo span {
    font-size: 12px;
    font-weight: 500;
    display: block;
    color: var(--accent);
    letter-spacing: 0.02em;
}

/* === Navigation === */
.nav-links {
    list-style: none;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    transition: color var(--transition), background var(--transition);
}

.nav-links a:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-links a.active {
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
}

.nav-links span.nav-link.disabled {
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.theme-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.header-actions .logout-link {
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--accent-border);
    transition: all var(--transition);
}

.header-actions .logout-link:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.header-register-btn {
    color: #000;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    background: var(--accent);
    transition: all var(--transition);
}

.header-register-btn:hover {
    background: var(--accent-mid);
}

/* === User Header === */
.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
    flex-wrap: wrap;
    gap: 16px;
}

.user-header h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.action-buttons a.btn {
    padding: 12px 28px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
    border: none;
}

.action-buttons .btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.action-buttons .btn-secondary:hover {
    background: var(--accent-soft);
    border-color: var(--accent-mid);
}

.action-buttons a.purchase {
    background: var(--accent);
    color: #000;
    box-shadow: var(--shadow-accent);
}

.action-buttons a.purchase:hover {
    background: var(--accent-mid);
    transform: translateY(-1px);
}

/* === Cards === */
.card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius-lg);
    margin-bottom: 28px;
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    border-bottom: 1px solid var(--accent-border);
    padding-bottom: 18px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    font-weight: 600;
    color: var(--accent);
    margin: 0;
    letter-spacing: -0.01em;
}

.card-header a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.card-header--chart {
    border-bottom: none;
    padding-bottom: 0;
}

/* === Info Card (Portfolio) === */
.info-card {
    background: linear-gradient(145deg, var(--card-bg) 0%, rgba(253, 116, 72, 0.06) 100%);
    border-color: rgba(253, 116, 72, 0.15);
}

.info-card .info-content {
    display: flex;
    gap: 48px;
    flex-wrap: wrap;
}

.info-card .info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-card .info-label {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-card .info-value {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--accent);
}

/* === Chart === */
.chart-body {
    padding-top: 1rem;
}

.chart-price {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.chart-subtitle {
    color: var(--text-dim);
    font-size: 0.88rem;
    margin-top: 4px;
}

#sharePriceChart {
    margin-top: 20px;
}

#chart-filter-buttons {
    display: flex;
    gap: 6px;
}

.chart-filter-btn {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border-radius: var(--radius-pill);
    padding: 6px 16px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.chart-filter-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.chart-filter-btn.active {
    background: var(--accent);
    color: #000;
}

/* ApexCharts dark theme override */
.apexcharts-tooltip {
    background: var(--card-elevated) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-card) !important;
}

.apexcharts-tooltip .apexcharts-tooltip-title {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--divider) !important;
}

/* === Timeline (News) === */
.timeline .timeline-item {
    margin-bottom: 20px;
    padding: 20px 24px;
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.timeline .timeline-item:hover {
    border-color: var(--border-hover);
}

.timeline-item h4 {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.timeline-item p {
    font-size: 15px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

.timeline-item p strong {
    color: var(--text-primary);
    font-weight: 600;
}

#loading-trigger {
    height: 10px;
}

.loading-indicator {
    text-align: center;
    padding: 24px;
    display: none;
    color: var(--text-dim);
    font-size: 14px;
}

/* === Data Tables === */
.card:has(.data-table) {
    max-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 8px;
    table-layout: fixed;
}

.data-table thead th {
    color: var(--accent);
    border-bottom: 2px solid var(--accent-border);
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.data-table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--divider);
    color: var(--text-primary);
    font-size: 15px;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* === Status Badges === */
.status-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-pending {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.status-approved {
    background: rgba(40, 167, 69, 0.15);
    color: #4cdf79;
}

.status-rejected {
    background: rgba(220, 53, 69, 0.15);
    color: #ff6b7a;
}

.status-canceled {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-dim);
}

/* === Forms === */
.form-card {
    max-width: 760px;
    margin: 0 auto;
    background: linear-gradient(145deg, var(--card-bg) 0%, var(--surface) 100%);
}

.form-card .card-header {
    flex-wrap: wrap;
    gap: 8px;
}

.form-card .card-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 15px;
}

.request-form .form-group,
.auth-form .form-group {
    margin-bottom: 22px;
}

.request-form label,
.auth-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.request-form input[type="number"],
.request-form select,
.request-form textarea,
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 16px 20px;
    background: var(--dark-bg);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.request-form input:focus,
.request-form select:focus,
.request-form textarea:focus,
.auth-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

.request-form input::placeholder,
.request-form textarea::placeholder,
.auth-form input::placeholder {
    color: var(--text-dim);
}

.request-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 4 3.5-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

.request-form select option {
    background: var(--dark-bg);
    color: var(--text-primary);
}

.request-form textarea {
    min-height: 100px;
    resize: vertical;
}

.request-form button[type="submit"],
.btn.btn-primary.purchase {
    width: 100%;
    padding: 16px 28px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    margin-top: 8px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    box-shadow: var(--shadow-accent);
    transition: all var(--transition);
    letter-spacing: 0.02em;
}

.request-form button[type="submit"]:hover {
    background: var(--accent-mid);
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(253, 116, 72, 0.45);
}

/* === Alerts & Messages === */
.messages-container {
    margin-bottom: 24px;
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(40, 167, 69, 0.12);
    color: #4cdf79;
    border-color: rgba(40, 167, 69, 0.2);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.12);
    color: #ffc107;
    border-color: rgba(255, 193, 7, 0.2);
}

.alert-error,
.alert-danger {
    background: rgba(220, 53, 69, 0.12);
    color: #ff6b7a;
    border-color: rgba(220, 53, 69, 0.2);
}

.alert-info {
    background: rgba(23, 162, 184, 0.12);
    color: #3dd5f3;
    border-color: rgba(23, 162, 184, 0.2);
}

/* === Form Errors === */
.errorlist {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    color: #ff6b7a;
    font-size: 13px;
    font-weight: 500;
}

/* === Auth Pages === */
.auth-container {
    max-width: 520px;
    margin: 60px auto;
    padding: 48px 44px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

.auth-container--centered {
    text-align: center;
}

.auth-container--centered p {
    color: var(--text-muted);
    line-height: 1.6;
}

.auth-container h1 {
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    text-align: center;
    margin: 0 0 28px;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.auth-form .auth-button {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    margin-top: 12px;
    box-shadow: var(--shadow-accent);
    transition: all var(--transition);
    letter-spacing: 0.02em;
}

.auth-button--inline {
    display: inline-block;
    width: auto;
    padding: 12px 28px;
    text-decoration: none;
    margin-top: 16px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-accent);
    transition: all var(--transition);
}

.auth-form .auth-button:hover,
.auth-button--inline:hover {
    background: var(--accent-mid);
    transform: translateY(-1px);
}

.auth-links {
    text-align: center;
    margin-top: 24px;
}

.auth-links a {
    color: var(--accent);
    text-decoration: none;
    margin: 0 10px;
    font-size: 14px;
    font-weight: 500;
    transition: color var(--transition);
}

.auth-links a:hover {
    color: var(--accent-mid);
}

/* === Language Switcher === */
.language-switcher {
    position: relative;
    cursor: pointer;
}

.current-language {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-pill);
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition);
}

.current-language:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.25);
}

.current-language .fa-chevron-down {
    font-size: 10px;
    transition: transform var(--transition);
}

.language-switcher.open .fa-chevron-down {
    transform: rotate(180deg);
}

.language-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-sm);
    min-width: 140px;
    z-index: 10;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.language-switcher.open .language-dropdown {
    display: block;
}

.language-dropdown .lang-form button {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 10px 16px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    transition: all var(--transition);
}

.language-dropdown .lang-form button:hover {
    background: var(--accent);
    color: #000;
}

/* === Public Home / Hero === */
.hero-section {
    text-align: center;
    padding: 48px 24px 56px;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--accent);
    margin: 8px 0 0;
    font-weight: 500;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 36px;
}

.btn-hero {
    padding: 14px 36px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    border-radius: var(--radius-pill);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
    cursor: pointer;
    letter-spacing: 0.02em;
}

.btn-hero--primary {
    background: var(--accent);
    color: #000;
    border: 2px solid var(--accent);
    box-shadow: var(--shadow-accent);
}

.btn-hero--primary:hover {
    background: var(--accent-mid);
    border-color: var(--accent-mid);
    transform: translateY(-1px);
}

.btn-hero--outline {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.btn-hero--outline:hover {
    background: var(--accent-soft);
}

.public-cta {
    text-align: center;
    padding: 48px 24px;
    background: linear-gradient(145deg, var(--card-bg) 0%, rgba(253, 116, 72, 0.08) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--accent-border);
    margin-bottom: 28px;
}

.public-cta p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0 0 24px;
}

/* === Utility Classes === */
.text-center { text-align: center; }

/* === Icons === */
.fa, .fas {
    margin-right: 4px;
}

/* === Responsive === */
@media (max-width: 960px) {
    .content-wrapper {
        max-width: calc(100% - 32px);
    }

    .header-shell {
        padding: 12px 18px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 0;
    }

    .content-wrapper {
        max-width: calc(100% - 24px);
        padding-bottom: 40px;
    }

    .header {
        padding: 12px 12px;
    }

    .header-shell {
        padding: 12px 16px;
        border-radius: var(--radius-md);
        gap: 10px;
    }

    .nav-links {
        gap: 4px;
    }

    .nav-links a,
    .nav-links span.nav-link.disabled {
        font-size: 13px;
        padding: 6px 10px;
    }

    .user-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .user-header h1 {
        font-size: 1.5rem;
    }

    .info-card .info-content {
        flex-direction: column;
        gap: 16px;
    }

    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .auth-container {
        margin: 24px auto;
        max-width: calc(100% - 32px);
        padding: 32px 28px;
    }

    .card {
        padding: 22px;
        border-radius: var(--radius-md);
    }

    .chart-price {
        font-size: 1.5rem;
    }

    .timeline .timeline-item {
        padding: 16px 18px;
    }
}

@media (max-width: 560px) {
    .header-shell {
        flex-direction: column;
        align-items: stretch;
    }

    .header-shell > .logo {
        justify-content: center;
    }

    .header-shell > nav {
        order: 3;
    }

    .nav-links {
        justify-content: center;
        gap: 2px;
    }

    .header-actions {
        justify-content: center;
    }

    .action-buttons {
        width: 100%;
    }

    .action-buttons a.btn {
        flex: 1;
        justify-content: center;
        padding: 10px 16px;
        font-size: 13px;
    }

    .card {
        padding: 18px;
    }

    .card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    #chart-filter-buttons {
        flex-wrap: wrap;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 12px 10px;
        font-size: 13px;
    }
}
