/**
 * Soul Scrolls Archive Styles
 * Compact table layout for desktop, responsive cards for mobile
 * Immortal Nexus dark mystical theme
 */

/* ============================================================================
   CONTAINER & LAYOUT
   ============================================================================ */

.archive-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 200px);
}

/* ============================================================================
   HEADER SECTION
   ============================================================================ */

.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid rgba(255, 94, 120, 0.3);
    flex-wrap: wrap;
    gap: 1.5rem;
}

.archive-title-section {
    flex: 1;
}

.archive-title {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: #ff5e78;
    text-shadow: 0 0 20px rgba(255, 94, 120, 0.5);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.archive-title i {
    font-size: 2rem;
    color: #ff5e78;
}

.archive-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    font-size: 1.1rem;
}

.archive-nav {
    display: flex;
    gap: 1rem;
}

/* ============================================================================
   CONTROLS SECTION
   ============================================================================ */

.archive-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg,
        rgba(13, 13, 26, 0.9),
        rgba(26, 26, 51, 0.7));
    border: 1px solid rgba(255, 94, 120, 0.3);
    border-radius: 12px;
}

.search-section {
    flex: 1;
    min-width: 300px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 94, 120, 0.7);
    pointer-events: none;
}

.archive-search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 45px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 94, 120, 0.4);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.archive-search-input:focus {
    outline: none;
    border-color: #ff5e78;
    box-shadow: 0 0 10px rgba(255, 94, 120, 0.3);
}

.archive-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.filter-section {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.archive-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 94, 120, 0.4);
    border-radius: 6px;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.archive-select:hover {
    border-color: #ff5e78;
}

.archive-select:focus {
    outline: none;
    border-color: #ff5e78;
    box-shadow: 0 0 8px rgba(255, 94, 120, 0.3);
}

/* ============================================================================
   STATS BAR
   ============================================================================ */

.archive-stats {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid #ff5e78;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
}

.stat-item i {
    color: #ff5e78;
}

/* ============================================================================
   TABLE STYLES (DESKTOP)
   ============================================================================ */

.archive-table {
    width: 100%;
    background: linear-gradient(135deg,
        rgba(13, 13, 26, 0.98),
        rgba(26, 26, 51, 0.95));
    border: 1px solid rgba(255, 94, 120, 0.3);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.archive-table thead {
    background: rgba(255, 94, 120, 0.1);
    border-bottom: 2px solid rgba(255, 94, 120, 0.4);
}

.archive-table th {
    padding: 1rem;
    text-align: left;
    color: #ff5e78;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.archive-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.3s ease;
}

.archive-table th.sortable:hover {
    background: rgba(255, 94, 120, 0.15);
}

.archive-table th.sortable i {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.archive-table th.sortable:hover i {
    opacity: 1;
}

.archive-table th.sortable.sorted-asc i::before {
    content: "\f0de"; /* fa-sort-up */
}

.archive-table th.sortable.sorted-desc i::before {
    content: "\f0dd"; /* fa-sort-down */
}

.archive-table tbody tr {
    border-bottom: 1px solid rgba(255, 94, 120, 0.1);
    transition: background 0.3s ease;
}

.archive-table tbody tr:hover {
    background: rgba(255, 94, 120, 0.05);
}

.archive-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.2);
}

.archive-table tbody tr:nth-child(even):hover {
    background: rgba(255, 94, 120, 0.08);
}

.archive-table td {
    padding: 0.875rem 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

/* Column Specific Styles */
.col-title {
    width: 35%;
    min-width: 250px;
}

.col-author {
    width: 20%;
    min-width: 150px;
}

.col-date {
    width: 15%;
    min-width: 100px;
}

.col-stats {
    width: 8%;
    text-align: center;
    min-width: 60px;
}

.col-actions {
    width: 14%;
    min-width: 180px;
    text-align: center;
}

/* Title cell styling */
.scroll-title-cell {
    cursor: pointer;
    color: #fff;
    font-weight: 500;
    transition: color 0.3s ease;
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scroll-title-cell:hover {
    color: #ff5e78;
    text-decoration: none;
}

/* Author link */
.author-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.author-link:hover {
    color: #ff5e78;
}

/* Stats cells */
.stat-value {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 94, 120, 0.1);
    border-radius: 4px;
    min-width: 40px;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.action-btn {
    padding: 0.4rem 0.6rem;
    background: rgba(255, 94, 120, 0.1);
    border: 1px solid rgba(255, 94, 120, 0.3);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.action-btn:hover {
    background: rgba(255, 94, 120, 0.2);
    border-color: #ff5e78;
    color: #fff;
    transform: translateY(-1px);
}

.action-btn.btn-view {
    background: rgba(94, 120, 255, 0.1);
    border-color: rgba(94, 120, 255, 0.3);
}

.action-btn.btn-view:hover {
    background: rgba(94, 120, 255, 0.2);
    border-color: #5e78ff;
}

.action-btn.btn-upvote.voted {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
    color: #4caf50;
}

.action-btn.btn-downvote.voted {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.5);
    color: #f44336;
}

/* Loading state */
.loading-row td {
    text-align: center;
    padding: 3rem;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.6);
}

.loading-spinner i {
    font-size: 2rem;
    color: #ff5e78;
}

/* Empty state */
.empty-row td {
    text-align: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* ============================================================================
   MOBILE CARDS (RESPONSIVE)
   ============================================================================ */

.archive-mobile-cards {
    display: none; /* Hidden by default, shown on mobile */
}

.archive-card {
    background: linear-gradient(135deg,
        rgba(13, 13, 26, 0.98),
        rgba(26, 26, 51, 0.95));
    border: 1px solid rgba(255, 94, 120, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.archive-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 94, 120, 0.2);
}

.archive-card-title {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
}

.archive-card-title:hover {
    color: #ff5e78;
}

.archive-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.archive-card-meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.archive-card-meta-item i {
    color: #ff5e78;
    font-size: 0.85rem;
}

.archive-card-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.archive-card-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.archive-card-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ============================================================================
   PAGINATION
   ============================================================================ */

.archive-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
    padding: 1.5rem;
    flex-wrap: wrap;
}

.pagination-info {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.page-btn {
    padding: 0.5rem 0.75rem;
    background: rgba(255, 94, 120, 0.1);
    border: 1px solid rgba(255, 94, 120, 0.3);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.page-btn:hover:not(:disabled) {
    background: rgba(255, 94, 120, 0.2);
    border-color: #ff5e78;
    color: #fff;
    transform: translateY(-1px);
}

.page-btn.active {
    background: #ff5e78;
    border-color: #ff5e78;
    color: #fff;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-ellipsis {
    color: rgba(255, 255, 255, 0.5);
    padding: 0 0.5rem;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .archive-container {
        padding: 1rem;
    }

    .archive-header {
        flex-direction: column;
        text-align: center;
    }

    .archive-title {
        font-size: 2rem;
        justify-content: center;
    }

    .archive-nav {
        width: 100%;
        justify-content: center;
    }

    .archive-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .search-section {
        min-width: 100%;
    }

    .filter-section {
        width: 100%;
        justify-content: space-between;
    }

    /* Hide table on mobile */
    .archive-table {
        display: none;
    }

    /* Show cards on mobile */
    .archive-mobile-cards {
        display: block;
    }

    .archive-stats {
        justify-content: space-around;
        text-align: center;
    }

    .stat-item {
        flex-direction: column;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .archive-title {
        font-size: 1.5rem;
    }

    .archive-nav {
        flex-direction: column;
    }

    .archive-nav .btn {
        width: 100%;
        justify-content: center;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select {
        width: 100%;
    }
}

/* ============================================================================
   KEYBOARD NAVIGATION
   ============================================================================ */

.archive-table tbody tr:focus {
    outline: 2px solid #ff5e78;
    outline-offset: -2px;
    background: rgba(255, 94, 120, 0.1);
}

.archive-card:focus {
    outline: 2px solid #ff5e78;
    outline-offset: 2px;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

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

.archive-table tbody tr,
.archive-card {
    animation: fadeIn 0.3s ease forwards;
}

/* Stagger animation for rows */
.archive-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.archive-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.archive-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.archive-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.archive-table tbody tr:nth-child(5) { animation-delay: 0.25s; }