/* DASHBOARD SIDEBAR LAYOUT */
.dashboard-section {
    padding-top: 40px;
    padding-bottom: 80px;
}

.dashboard-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 900px) {
    .dashboard-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* SIDEBAR */
.dashboard-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 24px;
    position: sticky;
    top: 20px;
}

.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.user-avatar-large {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color, #21519d);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
}

.user-info h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--text-main);
}

.user-info p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    word-break: break-all;
}

.dashboard-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dash-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.dash-nav-item:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
    color: var(--text-main);
}

.dash-nav-item.is-active {
    background: var(--bg-active, rgba(33, 81, 157, 0.08));
    color: var(--primary-color, #21519d);
    font-weight: 600;
}

.dash-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.dash-nav-item.is-active .dash-icon {
    opacity: 1;
}

.dashboard-logout-area {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

/* DASHBOARD CONTENT */
.dash-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.dash-tab-content.is-active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dash-header {
    margin-bottom: 32px;
}

.dash-header h1 {
    font-family: "Playfair Display", serif;
    font-size: 32px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.dash-header p {
    color: var(--text-muted);
    font-size: 16px;
}

.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
}

/* FORMS */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-input, #ccc);
    font-size: 16px;
    background: var(--bg-input, #fff);
    color: var(--text-main);
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color, #21519d);
    box-shadow: 0 0 0 3px rgba(33, 81, 157, 0.1);
}

/* MATCH AUTH INPUTS FOR PROFILE & SECURITY */
#profile-form .form-group input,
#password-form .form-group input {
    padding: 0 12px !important;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-panel);
    color: var(--text-main);
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    height: 38px !important;
    line-height: 36px !important;
    min-height: 38px !important;
    width: 100% !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
}

#profile-form input:focus,
#password-form input:focus {
    outline: none;
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ORDERS LIST */
.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.order-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
}

.order-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.order-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.order-card {
    flex-direction: column;
    align-items: stretch;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.order-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    display: none;
    animation: fadeIn 0.2s ease;
}

.order-details.is-visible {
    display: block;
}

.order-items-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.order-items-list li {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.order-resource-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--primary-color, #21519d);
    text-decoration: none;
    font-weight: 500;
    margin-top: 4px;
}

.order-resource-link:hover {
    text-decoration: underline;
}

.btn-view-details {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    margin-top: 8px;
    text-decoration: underline;
}

.btn-view-details:hover {
    color: var(--primary-color, #21519d);
}

/* RESOURCES GRID */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.resource-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.resource-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-active);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color, #21519d);
    margin-bottom: 16px;
}

.resource-card h3 {
    font-size: 18px;
    margin: 0 0 8px 0;
}

.resource-card p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 20px 0;
    flex-grow: 1;
}

/* CHECKBOXES */
.checkbox-group {
    margin-bottom: 16px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: var(--bg-hover);
}

.checkbox-label input {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

/* SAVED STORY CARD (Media Object Layout) */
.saved-story-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    transition: transform 0.2s, box-shadow 0.2s;
}

.saved-story-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.saved-story-thumb {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-active);
    flex-shrink: 0;
}

.saved-story-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
}

.saved-story-content h3 {
    font-size: 18px;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.saved-story-date {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}

.saved-story-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.saved-story-actions .btn-sm {
    height: 32px;
    line-height: 30px;
    /* Adjust for border */
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .saved-story-card {
        flex-direction: column;
    }

    .saved-story-thumb {
        width: 100%;
        height: 160px;
    }
}

.checkbox-label input:checked+.checkbox-custom {
    background: var(--primary-color, #21519d);
    border-color: var(--primary-color, #21519d);
}

.checkbox-label input:checked+.checkbox-custom::after {
    content: "✓";
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-text strong {
    display: block;
    color: var(--text-main);
    margin-bottom: 2px;
}

.checkbox-text span {
    font-size: 13px;
    color: var(--text-muted);
}

/* TOAST NOTIFICATIONS */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    color: var(--text-main);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    border: 1px solid var(--border-subtle);
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #dcfce7;
    color: #166534;
    border-radius: 50%;
}

[data-theme="dark"] .toast-icon {
    background: rgba(22, 101, 52, 0.3);
    color: #4ade80;
}

/* BUTTON LOADING STATE */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    margin-top: -9px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

.btn-ghost.btn-loading::after {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: var(--text-main);
}

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

/* PASSWORD POPUP */
.password-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.password-popup-overlay[hidden] {
    display: none;
}

.password-popup-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-strong);
    transform: scale(0.95);
    animation: scaleIn 0.3s forwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

@keyframes scaleIn {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-icon {
    width: 64px;
    height: 64px;
    background: transparent;
    color: #166534;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

[data-theme="dark"] .popup-icon {
    background: transparent;
    color: #4ade80;
}

.password-popup-card h3 {
    font-family: "Inter", sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.password-popup-card p {
    color: var(--text-muted);
    font-size: 15px;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.password-popup-card .btn-primary {
    width: 100%;
    justify-content: center;
    height: 44px;
    font-size: 15px;
}

/* Verification Banner */
.verification-banner {
    background-color: #fff3cd;
    border-bottom: 1px solid #ffeeba;
    color: #856404;
    padding: 1rem;
    margin-bottom: 2rem;
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.verification-banner .banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
}

.verification-banner .btn-text {
    background: none;
    border: none;
    color: #856404;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}

.verification-banner .btn-text:hover {
    color: #533f03;
}