/* ==================== *arr Style Dark Theme for Dewy Oracle ==================== */

:root {
    /* *arr Dark Theme Colors */
    --bg-primary: #1e1e1e;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #333333;
    --bg-hover: #3a3a3a;

    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;

    --accent-primary: #5c7cfa;
    --accent-secondary: #7950f2;
    --accent-hover: #4c6ef5;

    --success: #51cf66;
    --warning: #ffa94d;
    --error: #ff6b6b;
    --info: #4dabf7;

    --border-color: #404040;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== Layout with Sidebar ==================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-logo img {
    height: 32px;
    width: 32px;
}

.sidebar-logo span {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin: 4px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    gap: 12px;
}

.sidebar-nav a:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background-color: var(--accent-primary);
    color: white;
}

.sidebar-user {
    position: absolute;
    bottom: 0;
    width: 220px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-name {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ==================== Main Content Area ==================== */

.main-content {
    margin-left: 220px;
    flex: 1;
    padding: 30px;
    min-height: 100vh;
}

.content-header {
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.content-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ==================== Cards ==================== */

.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.section {
    margin-bottom: 30px;
}

.section h2 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 600;
}

/* ==================== Buttons ==================== */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn:hover {
    background-color: var(--bg-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent-primary));
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
}

.btn-danger {
    background-color: var(--error);
    color: white;
}

.btn-danger:hover {
    background-color: #fa5252;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-large {
    padding: 14px 28px;
    font-size: 1.1rem;
}

.btn-full {
    width: 100%;
}

.btn-text {
    background: none;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-text:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

/* ==================== Actions Bar ==================== */

.actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.section-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* ==================== Messages ==================== */

.message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.message.success {
    background-color: rgba(81, 207, 102, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.message.error {
    background-color: rgba(255, 107, 107, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.message.hidden {
    display: none;
}

/* ==================== Loading Spinner ==================== */

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading:after {
    content: " .";
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: " ."; }
    40% { content: " .."; }
    60% { content: " ..."; }
    80%, 100% { content: " "; }
}

.hidden {
    display: none;
}

/* ==================== Empty State ==================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* ==================== Grids ==================== */

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.recommendation-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
}

.recommendation-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.recommendation-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.recommendation-card .author {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.recommendation-card .description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 12px;
}

.recommendation-card .reason {
    background-color: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
    padding: 12px;
    border-radius: 4px;
    margin-top: 12px;
}

.recommendation-card .reason strong {
    color: var(--accent-primary);
    display: block;
    margin-bottom: 6px;
}

.recommendation-card .reason p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.genres {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.genre-tag {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

/* ==================== History List ==================== */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: var(--accent-primary);
    background-color: var(--bg-tertiary);
}

.book-info h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.book-info .author {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.progress-info {
    text-align: right;
}

.status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status.finished {
    background-color: rgba(81, 207, 102, 0.15);
    color: var(--success);
}

.status.in-progress {
    background-color: rgba(74, 171, 247, 0.15);
    color: var(--info);
}

/* ==================== Reading Log ==================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
}

.chart-card h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.book-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.book-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.book-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--bg-tertiary);
}

.book-details {
    padding: 16px;
}

.book-title {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.book-author {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.book-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.book-rating {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.rating-stars {
    color: var(--warning);
    font-size: 1.1rem;
}

/* ==================== Forms ==================== */

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background-color: var(--bg-secondary);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.form-help {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.form-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.form-section h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* ==================== Settings ==================== */

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-item {
    background-color: var(--bg-tertiary);
    padding: 16px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.setting-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-primary);
}

.setting-item input[type="checkbox"] {
    margin-right: 12px;
    cursor: pointer;
}

/* ==================== Tables ==================== */

.users-table {
    width: 100%;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.users-table thead {
    background-color: var(--bg-tertiary);
}

.users-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table td {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.users-table tbody tr {
    transition: background-color 0.2s;
}

.users-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-admin {
    background-color: rgba(92, 124, 250, 0.2);
    color: var(--accent-primary);
}

.badge-active {
    background-color: rgba(81, 207, 102, 0.2);
    color: var(--success);
}

.badge-inactive {
    background-color: rgba(255, 107, 107, 0.2);
    color: var(--error);
}

.text-muted {
    color: var(--text-muted);
    font-style: italic;
}

/* ==================== Modals ==================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-small {
    max-width: 400px;
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.btn-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-content form {
    padding: 28px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* ==================== Auth Pages ==================== */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
}

.auth-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}

.auth-card h1 {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 2rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.auth-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.auth-footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* ==================== Landing Page ==================== */

.landing-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
    padding: 60px 20px;
}

.landing-hero {
    text-align: center;
    margin-bottom: 60px;
}

.landing-hero h1 {
    font-size: 3rem;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.landing-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.landing-features {
    max-width: 1200px;
    margin: 0 auto;
}

.landing-features h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
    color: var(--text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.feature-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
}

.feature-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-card h3 {
    margin-bottom: 12px;
    color: var(--accent-primary);
    font-size: 1.3rem;
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==================== Responsive Design ==================== */

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header span,
    .sidebar-nav a span,
    .sidebar-user-info {
        display: none;
    }

    .sidebar-user {
        width: 60px;
    }

    .main-content {
        margin-left: 60px;
        padding: 20px;
    }

    .recommendations-grid,
    .books-grid {
        grid-template-columns: 1fr;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }

    .landing-hero h1 {
        font-size: 2rem;
    }
}
