/* Global Styles */
:root {
    --primary-color: #1e40af;
    --secondary-color: #64748b;
    --error-color: #dc2626;
    --success-color: #16a34a;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    gap: 24px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
}

.auth-nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    min-width: 44px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #1e3a8a;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.3);
}

.btn-danger:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 8px 16px;
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
    display: inline-block;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: auto;
}

.btn-disabled:hover {
    box-shadow: none;
}

/* Hero Section */
.hero {
    background-image: url('/assets/buli.jpeg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    color: white;
    padding: 64px 24px;
    text-align: center;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.hero > * {
    position: relative;
    z-index: 2;
}

.hero h2 {
    font-size: 32px;
    margin-bottom: 16px;
}

.hero p {
    font-size: 18px;
    margin-bottom: 24px;
    opacity: 0.95;
}

/* Sections */
section {
    padding: 48px 24px;
}

section h3 {
    font-size: 28px;
    margin-bottom: 32px;
    text-align: center;
    color: var(--text-color);
}

/* TOC Grid */
.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.toc-card {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.toc-card-image {
    width: 100%;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    background-color: #e2e8f0;
}

.toc-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.toc-card:hover:not(.placeholder) {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-4px);
}

.toc-card h4 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.toc-card p {
    font-size: 14px;
    color: var(--secondary-color);
    margin-bottom: 16px;
}

.toc-card.placeholder {
    opacity: 0.7;
    background-color: #f1f5f9;
}

/* Placeholder Grid */
.placeholder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.placeholder-card {
    background-color: white;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 32px 24px;
    text-align: center;
    color: var(--secondary-color);
}

.placeholder-card h4 {
    font-size: 16px;
    margin-bottom: 8px;
}

/* Footer */
.footer {
    background-color: #1e293b;
    color: white;
    text-align: center;
    padding: 32px 24px;
    margin-top: 48px;
}

.footer p {
    font-size: 14px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
}

.close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--secondary-color);
}

.close:hover {
    color: var(--text-color);
}

.modal-content h2 {
    margin-bottom: 24px;
    font-size: 24px;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-content label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.modal-content input {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.modal-content input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.error-msg {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 8px;
}

/* Admin Page */
.admin-section {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.admin-section h4 {
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-row input[type="text"],
.form-row input[type="password"] {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px 16px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.admin-list {
    display: grid;
    gap: 16px;
}

.admin-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    background-color: #f8fafc;
}

.admin-card-header {
    margin-bottom: 12px;
}

.admin-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px 16px;
    margin-bottom: 12px;
}

.admin-card-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Permissions Table Styles */
.permissions-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 14px;
}

.permissions-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.permissions-table td {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-top: none;
}

.permission-row:nth-child(even) td {
    background-color: #f1f5f9;
}

.permission-row:nth-child(odd) td {
    background-color: white;
}

.permission-row td:first-child {
    font-weight: 500;
    color: var(--text-color);
}

.permission-checkbox {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    vertical-align: middle;
    margin-right: 4px;
}

.permission-checkbox:hover {
    transform: scale(1.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .header-content {
        flex-direction: column;
        padding: 12px 16px;
        gap: 12px;
    }

    .logo h1 {
        font-size: 20px;
    }

    .auth-nav {
        width: 100%;
    }

    .auth-nav button {
        flex: 1;
    }

    section {
        padding: 32px 16px;
    }

    section h3 {
        font-size: 22px;
        margin-bottom: 24px;
    }

    .hero {
        padding: 48px 16px;
    }

    .hero h2 {
        font-size: 24px;
    }

    .hero p {
        font-size: 16px;
    }

    .toc-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .placeholder-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .logo h1 {
        font-size: 18px;
    }

    .hero h2 {
        font-size: 20px;
    }

    .btn {
        min-height: 40px;
        padding: 8px 16px;
        font-size: 13px;
    }

    .btn-large {
        padding: 12px 24px;
    }
}
