/**
 * Success Stories Management - Styling (Theme Integrated)
 * User Dashboard, Admin Dashboard, and Homepage Components
 * Uses dashboard theme colors
 */

/* ============ VARIABLES (Using Dashboard Theme Colors) ============ */
:root {
    --primary: #007aff;
    --primary-light: #5ac8fa;
    --primary-dark: #0051d5;
    --success: #34c759;
    --warning: #ff9500;
    --danger: #ff3b30;
    --light-gray: #f2f2f7;
    --dark-gray: #3a3a3c;
    --border-radius: 8px;
    --transition: all 0.3s ease;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --box-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] {
    --light-gray: #1c1c1e;
    --dark-gray: #f2f2f7;
}

/* ============ STORIES LIST (USER DASHBOARD) ============ */
.stories-list {
    width: 100%;
    padding: 10px;
}

.stories-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-gray);
}

.stories-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 0;
}

.stat {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
    border-radius: var(--border-radius);
    color: white;
    text-align: center;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.stat:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow-lg);
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .stat-label {
    color: rgba(255, 255, 255, 0.9);
}

/* ============ STORIES GRID ============ */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

/* ============ STORY CARD ============ */
.story-card {
    background: var(--card-bg, white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    border-left: 4px solid var(--primary);
}

[data-theme="dark"] .story-card {
    --card-bg: #1c1c1e;
}

.story-card:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-8px);
}

.story-card.status-draft {
    border-left-color: #8e8e93;
}

.story-card.status-pending {
    border-left-color: var(--warning);
}

.story-card.status-approved {
    border-left-color: var(--success);
}

.story-card.status-rejected {
    border-left-color: var(--danger);
}

.story-header {
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

[data-theme="dark"] .story-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.story-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.story-status.status-draft {
    background-color: rgba(142, 142, 147, 0.2);
    color: #8e8e93;
}

.story-status.status-pending {
    background-color: rgba(255, 149, 0, 0.2);
    color: var(--warning);
}

.story-status.status-approved {
    background-color: rgba(255, 255, 255, 0.94);
    color: #1abf44;
}

.story-status.status-rejected {
    background-color: rgba(255, 59, 48, 0.2);
    color: var(--danger);
}

.story-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.story-content {
    padding: 16px;
    flex: 1;
}

.story-title {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-dark);
    line-height: 1.4;
}

[data-theme="dark"] .story-title {
    color: var(--primary-light);
}

.story-excerpt {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

[data-theme="dark"] .story-excerpt {
    color: #aaa;
}

.story-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #999;
}

.word-count,
.view-count {
    display: flex;
    align-items: center;
    gap: 4px;
}

.story-actions {
    padding: 12px 16px;
    background-color: var(--light-gray);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

[data-theme="dark"] .story-actions {
    background-color: #2c2c2e;
    border-top-color: rgba(255, 255, 255, 0.1);
}

.story-actions .btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-sm {
    padding: 6px 10px !important;
    font-size: 11px !important;
}

.btn-info {
    background-color: var(--primary);
    color: white;
}

.btn-info:hover {
    background-color: var(--primary-dark);
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-warning:hover {
    background-color: #e68900;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #e02d26;
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #2fa84d;
}

.rejection-reason {
    background-color: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.3);
    border-radius: 4px;
    padding: 12px;
    margin-top: 12px;
    font-size: 12px;
    color: #ff9500;
}

[data-theme="dark"] .rejection-reason {
    background-color: rgba(255, 149, 0, 0.15);
    border-color: rgba(255, 149, 0, 0.4);
}

.rejection-reason p {
    margin: 4px 0;
}

.rejection-reason strong {
    display: block;
    margin-bottom: 6px;
}

/* ============ STORY FORM MODAL ============ */
.story-form-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    background: var(--card-bg, white);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--box-shadow-lg);
    animation: slideUp 0.3s ease;
}

[data-theme="dark"] .modal-content {
    --card-bg: #1c1c1e;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.2), rgba(114, 9, 183, 0.2));
    color: #f5f5f7;
    border-radius: 16px 16px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    color: #f5f5f7;
    background: linear-gradient(135deg, #4361ee, #7209b7, #00f5d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(67, 97, 238, 0.3);
    color: #00f5d4;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(0, 245, 212, 0.2);
    border-color: #00f5d4;
    color: #00f5d4;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 245, 212, 0.5);
}

.modal-body {
    padding: 24px;
    color: #f5f5f7;
}

.story-content-text {
    color: rgba(245, 245, 247, 0.9);
    line-height: 1.8;
    font-size: 16px;
    padding: 20px;
    background: rgba(67, 97, 238, 0.08);
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid rgba(67, 97, 238, 0.15);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.modal-content.story-view-modal .story-content-text {
    background: rgba(67, 97, 238, 0.08) !important;
    color: rgba(245, 245, 247, 0.9) !important;
    border: 1px solid rgba(67, 97, 238, 0.15) !important;
}

.modal-footer {
    padding: 16px 24px;
    background: rgba(67, 97, 238, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-radius: 0 0 16px 16px;
}

[data-theme="dark"] .modal-footer {
    background-color: #2c2c2e;
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* ============ STORY FORM ============ */
.story-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--primary-dark);
    font-size: 14px;
}

[data-theme="dark"] .form-group label {
    color: var(--primary-light);
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
    color: var(--dark-gray);
    background: var(--card-bg, white);
}

/* Dark background for contact form inputs to match page theme */
.contact-form .form-group input,
.contact-form .form-group textarea {
    background: rgba(5, 10, 26, 0.5);
    border: 1px solid rgba(67, 97, 238, 0.2);
    color: rgba(245, 245, 247, 0.9);
}

.contact-form .form-group input:focus,
.contact-form .form-group textarea:focus {
    border-color: #00f5d4;
    box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.2);
    outline: none;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea {
    --card-bg: #1c1c1e;
    border-color: #2c2c2e;
    color: #f2f2f7;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 200px;
}

.form-text {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

.word-counter {
    margin-top: 8px;
    padding: 10px 12px;
    background-color: var(--light-gray);
    border-radius: 4px;
    font-size: 12px;
    color: var(--dark-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-theme="dark"] .word-counter {
    background-color: #2c2c2e;
    color: #f2f2f7;
}

.word-counter.error {
    background-color: rgba(255, 149, 0, 0.1);
    color: var(--warning);
    border: 1px solid rgba(255, 149, 0, 0.3);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .form-actions {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.form-actions .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.6), rgba(114, 9, 183, 0.6));
    color: #f5f5f7;
    border: 1px solid rgba(67, 97, 238, 0.5);
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.8), rgba(114, 9, 183, 0.8));
    border-color: #00f5d4;
    box-shadow: 0 6px 20px rgba(0, 245, 212, 0.4);
    transform: translateY(-2px);
}

/* ============ INLINE STORY FORM ============ */
.story-form-inline {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    background: var(--surface, #1c1c1e);
    border-radius: 12px;
    border: 1px solid var(--border, #38383a);
}

.story-form-inline .form-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.story-form-inline .form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.story-form-inline .form-group input,
.story-form-inline .form-group textarea {
    width: 100%;
    background: var(--card-bg, #2c2c2e);
    border: 2px solid var(--border, #38383a);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary, #ffffff);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.story-form-inline .form-group input:focus,
.story-form-inline .form-group textarea:focus {
    border-color: var(--primary, #007aff);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.story-form-inline .form-group textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.6;
}

.story-form-inline .form-text {
    font-size: 12px;
    color: var(--text-tertiary, #9ca3af);
    margin-top: 4px;
}

.story-form-inline .word-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--card-bg, #2c2c2e);
    border: 1px solid var(--border, #38383a);
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-secondary, #d1d5db);
    margin-top: 8px;
}

/* Inline Form Actions */
.form-actions-inline {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid var(--border, #38383a);
}

.form-actions-inline .btn {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    min-width: 90px;
}

.form-actions-inline .btn:hover {
    transform: translateY(-2px);
}

.form-actions-inline .btn-secondary {
    background: var(--surface, #1c1c1e);
    color: var(--text-primary, #ffffff);
    border: 2px solid var(--border, #38383a);
}

.form-actions-inline .btn-secondary:hover {
    background: var(--primary, #007aff);
    border-color: var(--primary, #007aff);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.form-actions-inline .btn-warning {
    background: linear-gradient(135deg, var(--warning, #ff9500) 0%, #ff8400 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

.form-actions-inline .btn-success {
    background: linear-gradient(135deg, var(--success, #34c759) 0%, #30d158 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

/* Back Button - Theme Color */
.btn-back {
    background: linear-gradient(135deg, var(--primary, #007aff) 0%, var(--primary-dark, #0051d5) 100%);
    color: white !important;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4);
}

/* Mobile Responsive - Dynamic Height */
@media (max-width: 768px) {
    .stories-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat {
        padding: 16px 14px;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    .stat-number {
        font-size: 28px;
        margin-bottom: 0;
    }

    .stat-label {
        font-size: 12px;
    }

    .story-form-inline {
        padding: 16px;
        gap: 16px;
    }

    .story-form-inline .form-group textarea {
        min-height: 25vh;
        max-height: 40vh;
    }

    .form-actions-inline {
        flex-wrap: wrap;
    }

    .form-actions-inline .btn {
        flex: 1;
        min-width: 80px;
        padding: 12px 10px;
    }

    .btn-back {
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .story-form-inline {
        padding: 14px;
        gap: 14px;
    }

    .story-form-inline .form-group label {
        font-size: 12px;
    }

    .story-form-inline .form-group textarea {
        min-height: 20vh;
        max-height: 35vh;
    }

    .form-actions-inline .btn {
        font-size: 12px;
        padding: 10px 8px;
    }

    .btn-back {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* ============ STORY VIEW MODAL ============ */
.story-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-view-modal {
    width: 90% !important;
    max-width: 800px !important;
    min-width: 600px !important;
}

.modal-content.story-view-modal {
    width: 90% !important;
    max-width: 800px !important;
    min-width: 600px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(67, 97, 238, 0.3) !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(67, 97, 238, 0.2) !important;
    color: #f5f5f7 !important;
    animation: slideUp 0.3s ease !important;
    transform-origin: center center !important;
    will-change: transform, opacity;
}

/* Prevent modal from shrinking after animation */
.modal-content.story-view-modal.animation-complete {
    animation: none !important;
    transform: translateY(0) !important;
    width: 90% !important;
    max-width: 800px !important;
    min-width: 600px !important;
}

.story-modal .modal-content.story-view-modal {
    width: 90% !important;
    max-width: 800px !important;
    min-width: 600px !important;
}

.story-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 8px;
    margin-left: 0;
    margin-right: 0;
}

.story-meta-info span {
    color: #00f5d4;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.story-meta-info i {
    color: #00f5d4;
}

/* Story Author Info Box - Theme Compatible */
.story-author-info-box {
    background-color: var(--surface);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

[data-theme="dark"] .story-author-info-box {
    background-color: var(--card-bg);
    border-color: var(--border);
}

.story-author-info-box .author-details {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.story-author-info-box .author-details strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Admin Review Section - Theme Compatible */
.admin-review-section {
    background-color: var(--primary-light);
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
    border: 1px solid var(--border);
}

[data-theme="dark"] .admin-review-section {
    background-color: rgba(0, 122, 255, 0.15);
    border-color: var(--primary);
}

.admin-review-section h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 16px;
}

.admin-review-section .form-group {
    margin-bottom: 12px;
}

.admin-review-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.admin-review-section textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    background-color: var(--surface);
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
}

.admin-review-section .action-buttons {
    display: flex;
    gap: 8px;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.status-draft {
    background-color: rgba(142, 142, 147, 0.1);
    color: #8e8e93;
}

.status-badge.status-pending {
    background-color: rgba(255, 149, 0, 0.1);
    color: var(--warning);
}

.status-badge.status-approved {
    background-color: rgba(52, 199, 89, 0.1);
    color: var(--success);
}

.status-badge.status-rejected {
    background-color: rgba(255, 59, 48, 0.1);
    color: var(--danger);
}

.story-meta-info span {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #999;
}

.rejection-alert {
    background-color: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 20px;
    color: var(--danger);
}

[data-theme="dark"] .rejection-alert {
    background-color: rgba(255, 59, 48, 0.15);
    border-color: rgba(255, 59, 48, 0.4);
}

.rejection-alert i {
    margin-right: 8px;
}

.admin-notes {
    background-color: rgba(0, 122, 255, 0.08);
    border: 1px solid rgba(0, 122, 255, 0.2);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 20px;
    color: var(--primary-dark);
}

[data-theme="dark"] .admin-notes {
    background-color: rgba(0, 122, 255, 0.12);
    border-color: rgba(0, 122, 255, 0.3);
    color: var(--primary-light);
}

.admin-notes h4 {
    margin: 0 0 8px 0;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-notes p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
}

/* Duplicate removed - using main .story-content-text definition above */

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 64px;
    color: var(--primary);
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    color: var(--primary-dark);
}

[data-theme="dark"] .empty-state h3 {
    color: var(--primary-light);
}

.empty-state p {
    margin: 0 0 20px 0;
    font-size: 14px;
}

.empty-state .btn {
    margin-top: 12px;
}

/* ============ LOADING STATE ============ */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--primary);
}

.spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============ TOAST NOTIFICATIONS ============ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    color: white;
    display: none;
    /* Hidden by default - shown via JavaScript */
    align-items: center;
    gap: 12px;
    font-weight: 500;
    box-shadow: var(--box-shadow-lg);
    animation: slideInRight 0.3s ease;
    z-index: 2000;
    max-width: 400px;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    background-color: var(--success);
}

.toast-error {
    background-color: var(--danger);
}

.toast-info {
    background-color: var(--primary);
}

/* ============ ADMIN DASHBOARD STYLES ============ */
.stories-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.stories-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.stories-table th {
    padding: 16px;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid var(--primary);
}

.stories-table td {
    padding: 16px;
    border-bottom: 1px solid var(--light-gray);
    color: var(--dark-gray);
}

[data-theme="dark"] .stories-table td {
    border-bottom-color: #2c2c2e;
    color: #f2f2f7;
}

.stories-table tbody tr {
    transition: var(--transition);
    background: var(--card-bg, white);
}

[data-theme="dark"] .stories-table tbody tr {
    --card-bg: #1c1c1e;
}

.stories-table tbody tr:hover {
    background-color: var(--light-gray);
}

[data-theme="dark"] .stories-table tbody tr:hover {
    background-color: #2c2c2e;
}

.admin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-actions .btn {
    padding: 6px 12px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

/* ============ HOMEPAGE SUCCESS STORIES SECTION ============ */
.success-stories-section {
    background: transparent;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background-color: rgba(5, 10, 26, 0.3);
    position: relative;
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
}

[data-theme="dark"] .success-stories-section {
    background: transparent;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background-color: rgba(5, 10, 26, 0.3);
}

.section-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    width: 100%;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 0 20px;
}

.section-header h2 {
    font-size: 36px;
    font-weight: bold;
    background: linear-gradient(135deg, #4361ee, #7209b7, #00f5d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 12px 0;
    font-family: "Orbitron", sans-serif;
    position: relative;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #7209b7, #00f5d4, #4361ee);
    border-radius: 2px;
}

[data-theme="dark"] .section-header h2 {
    background: linear-gradient(135deg, #4361ee, #7209b7, #00f5d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    font-size: 16px;
    color: #f5f5f7;
    margin: 20px auto 0;
    line-height: 1.6;
    max-width: 600px;
    opacity: 0.9;
}

[data-theme="dark"] .section-header p {
    color: #f5f5f7;
    opacity: 0.9;
}

/* ============ CAROUSEL CONTAINER ============ */
.stories-carousel {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 60px auto 0;
    padding: 60px 0 140px;
    overflow-x: hidden;
    overflow-y: visible;
}

.carousel-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    perspective: 1500px;
    min-height: 600px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
}

.carousel-track {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 520px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
    overflow-x: visible;
    overflow-y: visible;
    margin: 0 auto;
    padding-top: 60px;
}

.homepage-story-card {
    position: absolute;
    width: 350px;
    left: 50%;
    top: 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(67, 97, 238, 0.3);
    opacity: 0.6;
    transform: translateX(-50%) scale(0.85) translateZ(-200px);
    cursor: pointer;
    transform-origin: center center;
}

.homepage-story-card.active {
    opacity: 1;
    transform: translateX(-50%) scale(1.15) translateZ(0px);
    z-index: 10;
    box-shadow: 0 20px 60px rgba(67, 97, 238, 0.4), 0 0 40px rgba(114, 9, 183, 0.3);
    border-color: rgba(0, 245, 212, 0.6);
}

.homepage-story-card.prev {
    transform: translateX(calc(-50% - 380px)) scale(0.92) translateZ(-100px) rotateY(12deg);
    z-index: 5;
    opacity: 0.85;
}

.homepage-story-card.next {
    transform: translateX(calc(-50% + 380px)) scale(0.92) translateZ(-100px) rotateY(-12deg);
    z-index: 5;
    opacity: 0.85;
}

.homepage-story-card.prev-2 {
    transform: translateX(calc(-50% - 680px)) scale(0.78) translateZ(-200px) rotateY(20deg);
    opacity: 0.65;
    z-index: 3;
}

.homepage-story-card.next-2 {
    transform: translateX(calc(-50% + 680px)) scale(0.78) translateZ(-200px) rotateY(-20deg);
    opacity: 0.65;
    z-index: 3;
}

.homepage-story-card.prev-3 {
    transform: translateX(calc(-50% - 950px)) scale(0.65) translateZ(-300px) rotateY(25deg);
    opacity: 0.45;
    z-index: 2;
}

.homepage-story-card.next-3 {
    transform: translateX(calc(-50% + 950px)) scale(0.65) translateZ(-300px) rotateY(-25deg);
    opacity: 0.45;
    z-index: 2;
}

.homepage-story-card.prev-4 {
    transform: translateX(calc(-50% - 1150px)) scale(0.55) translateZ(-400px) rotateY(30deg);
    opacity: 0.35;
    z-index: 1;
}

.homepage-story-card.next-4 {
    transform: translateX(calc(-50% + 1150px)) scale(0.55) translateZ(-400px) rotateY(-30deg);
    opacity: 0.35;
    z-index: 1;
}

.homepage-story-card.prev-5 {
    transform: translateX(calc(-50% - 1300px)) scale(0.48) translateZ(-500px) rotateY(35deg);
    opacity: 0.25;
    z-index: 0;
}

.homepage-story-card.next-5 {
    transform: translateX(calc(-50% + 1300px)) scale(0.48) translateZ(-500px) rotateY(-35deg);
    opacity: 0.25;
    z-index: 0;
}

.homepage-story-card.hidden {
    display: none;
    visibility: hidden;
    opacity: 0;
}

[data-theme="dark"] .homepage-story-card {
    background: rgba(28, 28, 30, 0.8);
}

.homepage-story-card:hover:not(.active) {
    opacity: 0.8;
    transform: scale(0.95);
}

.story-card-body {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.story-card-title {
    font-size: 20px;
    font-weight: bold;
    color: #f5f5f7;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
}

.homepage-story-card.active .story-card-title {
    font-size: 22px;
    color: #00f5d4;
}

[data-theme="dark"] .story-card-title {
    color: #f5f5f7;
}

.story-card-excerpt {
    font-size: 14px;
    color: rgba(245, 245, 247, 0.8);
    line-height: 1.6;
    margin: 0 0 16px 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.homepage-story-card.active .story-card-excerpt {
    -webkit-line-clamp: 5;
    font-size: 15px;
    color: rgba(245, 245, 247, 0.95);
}

[data-theme="dark"] .story-card-excerpt {
    color: rgba(245, 245, 247, 0.8);
}

.story-card-author {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .story-card-author {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.author-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4361ee, #7209b7, #00f5d4);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.homepage-story-card.active .author-avatar {
    width: 50px;
    height: 50px;
    font-size: 18px;
    box-shadow: 0 6px 20px rgba(0, 245, 212, 0.4);
}

.author-info {
    flex: 1;
}

.author-name {
    font-weight: bold;
    color: #f5f5f7;
    font-size: 14px;
    margin: 0;
}

.homepage-story-card.active .author-name {
    color: #00f5d4;
}

[data-theme="dark"] .author-name {
    color: #f5f5f7;
}

.author-location {
    font-size: 12px;
    color: rgba(245, 245, 247, 0.7);
    margin: 0;
}

[data-theme="dark"] .author-location {
    color: rgba(245, 245, 247, 0.7);
}

.story-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    color: rgba(245, 245, 247, 0.7);
    gap: 12px;
}

.story-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(245, 245, 247, 0.7);
}

.story-meta i {
    font-size: 14px;
    color: rgba(0, 245, 212, 0.7);
}

[data-theme="dark"] .story-card-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
    color: rgba(245, 245, 247, 0.7);
}

.read-more-btn {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4361ee, #7209b7);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.read-more-btn:hover {
    background: linear-gradient(135deg, #7209b7, #00f5d4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 245, 212, 0.4);
}

.homepage-story-card.active .read-more-btn {
    background: linear-gradient(135deg, #00f5d4, #4361ee);
    box-shadow: 0 6px 25px rgba(0, 245, 212, 0.5);
}

/* ============ CAROUSEL NAVIGATION ============ */
.carousel-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 0;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    z-index: 100;
    padding: 15px 20px;
}

.carousel-arrow {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(67, 97, 238, 0.2);
    border: 2px solid rgba(67, 97, 238, 0.5);
    color: #00f5d4;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.carousel-arrow:hover {
    background: rgba(67, 97, 238, 0.4);
    border-color: #00f5d4;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 245, 212, 0.5);
}

.carousel-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.carousel-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(67, 97, 238, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot.active {
    background: #00f5d4;
    border-color: #00f5d4;
    width: 32px;
    border-radius: 6px;
    box-shadow: 0 0 15px rgba(0, 245, 212, 0.6);
}

.carousel-dot:hover {
    background: rgba(0, 245, 212, 0.6);
    border-color: #00f5d4;
}

/* ============ RESPONSIVE DESIGN ============ */
@media (max-width: 1024px) {
    .stories-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }

    .stories-carousel {
        padding: 40px 0 100px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .carousel-wrapper {
        width: 100%;
        max-width: 100%;
        padding: 0 20px;
        overflow-x: hidden;
    }

    .carousel-track {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .homepage-story-card {
        width: 300px;
    }

    .homepage-story-card.active {
        transform: translateX(-50%) scale(1.1) translateZ(0px);
    }

    .homepage-story-card.prev {
        transform: translateX(calc(-50% - 300px)) scale(0.88) translateZ(-100px) rotateY(12deg);
    }

    .homepage-story-card.next {
        transform: translateX(calc(-50% + 300px)) scale(0.88) translateZ(-100px) rotateY(-12deg);
    }

    .homepage-story-card.prev-2 {
        transform: translateX(calc(-50% - 520px)) scale(0.75) translateZ(-200px) rotateY(20deg);
    }

    .homepage-story-card.next-2 {
        transform: translateX(calc(-50% + 520px)) scale(0.75) translateZ(-200px) rotateY(-20deg);
    }

    .homepage-story-card.prev-3 {
        transform: translateX(calc(-50% - 700px)) scale(0.62) translateZ(-300px) rotateY(25deg);
    }

    .homepage-story-card.next-3 {
        transform: translateX(calc(-50% + 700px)) scale(0.62) translateZ(-300px) rotateY(-25deg);
    }

    .carousel-nav {
        margin-top: 30px;
    }

    .stories-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .modal-content {
        width: 95%;
    }
}

@media (max-width: 768px) {
    .stories-grid {
        grid-template-columns: 1fr;
    }

    .story-view-modal {
        width: 95% !important;
        min-width: auto !important;
        max-width: 95% !important;
    }

    .modal-content.story-view-modal {
        width: 95% !important;
        min-width: auto !important;
        max-width: 95% !important;
    }

    .stories-carousel {
        padding: 30px 10px 80px;
    }

    .homepage-story-card {
        width: 85vw;
        max-width: 320px;
        min-width: 260px;
    }

    .homepage-story-card.active {
        transform: translateX(-50%) scale(1.05) translateZ(0px);
        width: 90vw;
        max-width: 340px;
    }

    .homepage-story-card.prev {
        transform: translateX(calc(-50% - 180px)) scale(0.8) translateZ(-100px) rotateY(15deg);
        opacity: 0.7;
    }

    .homepage-story-card.next {
        transform: translateX(calc(-50% + 180px)) scale(0.8) translateZ(-100px) rotateY(-15deg);
        opacity: 0.7;
    }

    .homepage-story-card.prev-2 {
        transform: translateX(calc(-50% - 320px)) scale(0.65) translateZ(-300px) rotateY(25deg);
        opacity: 0.4;
    }

    .homepage-story-card.next-2 {
        transform: translateX(calc(-50% + 320px)) scale(0.65) translateZ(-300px) rotateY(-25deg);
        opacity: 0.4;
    }

    .homepage-story-card.prev-3 {
        transform: translateX(calc(-50% - 420px)) scale(0.5) translateZ(-400px) rotateY(30deg);
        opacity: 0.25;
    }

    .homepage-story-card.next-3 {
        transform: translateX(calc(-50% + 420px)) scale(0.5) translateZ(-400px) rotateY(-30deg);
        opacity: 0.25;
    }

    .homepage-story-card.prev-4,
    .homepage-story-card.next-4,
    .homepage-story-card.prev-5,
    .homepage-story-card.next-5 {
        display: none;
    }

    .stories-carousel {
        width: 100%;
        max-width: 100%;
        padding: 30px 10px 80px;
        overflow-x: hidden;
    }

    .carousel-wrapper {
        width: 100%;
        max-width: 100%;
        padding: 0 10px;
        perspective: 800px;
        min-height: 450px;
        overflow-x: hidden;
    }

    .carousel-track {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .carousel-nav {
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 40px);
        max-width: 400px;
        flex-wrap: nowrap;
        gap: 10px;
        margin-top: 0;
        padding: 12px 15px;
        background: rgba(5, 10, 26, 0.95);
        backdrop-filter: blur(15px);
        border-radius: 50px;
        border: 1px solid rgba(67, 97, 238, 0.5);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }

    .carousel-arrow {
        width: 40px;
        height: 40px;
        font-size: 16px;
        flex-shrink: 0;
    }

    .carousel-dots {
        flex: 1;
        justify-content: center;
        gap: 6px;
        max-width: 200px;
    }

    .carousel-dot {
        width: 8px;
        height: 8px;
    }

    .carousel-dot.active {
        width: 24px;
        height: 8px;
    }

    /* .stories-stats {
        grid-template-columns: 1fr;
    } */

    .story-header {
        flex-direction: column;
    }

    .story-actions {
        flex-direction: column;
    }

    .story-actions .btn {
        width: 100%;
        min-width: unset;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .section-header h2 {
        font-size: 28px;
    }

    .success-stories-section {
        padding: 50px 15px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: unset;
    }

    .admin-actions {
        flex-direction: column;
    }

    .admin-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stat {
        padding: 16px;
    }

    .stat-number {
        font-size: 24px;
    }

    .story-title {
        font-size: 16px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .form-group textarea {
        min-height: 150px;
    }

    .section-header h2 {
        font-size: 24px;
    }

    .section-header p {
        font-size: 14px;
    }

    .stories-carousel {
        padding: 20px 5px 70px;
    }

    .carousel-wrapper {
        min-height: 400px;
        padding: 0 5px;
    }

    .homepage-story-card {
        width: 90vw;
        max-width: 300px;
        min-width: 240px;
    }

    .homepage-story-card.active {
        transform: translateX(-50%) scale(1.05) translateZ(0px);
        width: 95vw;
        max-width: 320px;
    }

    .homepage-story-card.prev {
        transform: translateX(calc(-50% - 180px)) scale(0.7) translateZ(-150px) rotateY(20deg);
        opacity: 0.3;
    }

    .homepage-story-card.next {
        transform: translateX(calc(-50% + 180px)) scale(0.7) translateZ(-150px) rotateY(-20deg);
        opacity: 0.3;
    }

    .carousel-wrapper {
        padding-bottom: 90px;
    }

    .carousel-nav {
        bottom: 5px;
        width: calc(100% - 20px);
        max-width: 350px;
        padding: 10px 12px;
        gap: 8px;
    }

    .carousel-arrow {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .carousel-dot {
        width: 6px;
        height: 6px;
    }

    .carousel-dot.active {
        width: 20px;
        height: 6px;
    }
}

/* ============ TEXT MUTED ============ */
.text-muted {
    color: #999;
}

[data-theme="dark"] .text-muted {
    color: #aaa;
}

/* ============ TABLE SCROLL WRAPPER ============ */
.table-scroll-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
    border-radius: var(--border-radius);
}