/* Base: reset, layout, nav, footer, shared components. Loaded on every page. */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #6366f1;
}

.nav-logo i {
    margin-right: 10px;
    font-size: 1.8rem;
}

.nav-greeting {
    color: #64748b;
    font-size: 1rem;
    font-weight: 500;
}

.nav-greeting strong {
    color: #6366f1;
    font-weight: 600;
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    transition: transform 0.3s ease;
}

.menu-toggle:hover {
    transform: scale(1.1);
}

.menu-toggle.active .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .bar:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.bar {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Vertical Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #6366f1;
}

.sidebar-logo i {
    margin-right: 10px;
    font-size: 1.5rem;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease, transform 0.3s ease;
    border-radius: 4px;
}

.sidebar-close:hover {
    color: #6366f1;
    transform: rotate(90deg);
    background: #f1f5f9;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

.sidebar-item {
    margin: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-link:hover {
    background: #f8fafc;
    color: #6366f1;
    border-left-color: #6366f1;
}

.sidebar-link.active {
    background: #f1f5f9;
    color: #6366f1;
    border-left-color: #6366f1;
    font-weight: 600;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
.main-content {
    margin-top: 70px;
}

.section {
    display: block;
    min-height: calc(100vh - 70px);
    padding: 80px 0;
}

/* Shared: buttons (used on multiple pages) */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #6366f1;
    color: white;
}

.btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: #6366f1;
    border: 2px solid #6366f1;
}

.btn-secondary:hover {
    background: #6366f1;
    color: white;
    transform: translateY(-2px);
}

/* Section Titles (used on multiple pages) */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 3rem;
}

/* Footer */
.footer {
    background: #1e293b;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #6366f1;
}

.footer-section p {
    color: #94a3b8;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: #6366f1;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #94a3b8;
}

/* Shared: form groups (auth, contact) */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6366f1;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Shared: alerts (auth) */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Error Modal (in base template, used globally) */
.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.error-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10001;
}

.error-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fef2f2;
}

.error-modal-header h3 {
    margin: 0;
    color: #dc2626;
    font-size: 1.5rem;
    font-weight: 600;
}

.error-modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.error-modal-body p {
    margin: 0 0 1rem 0;
    color: #333;
    line-height: 1.6;
}

.error-id {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: #666;
}

.error-id code {
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #1f2937;
    word-break: break-all;
}

.error-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.error-modal-close-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.error-modal-close-btn:hover {
    background: #b91c1c;
}

.error-modal-close-btn:active {
    background: #991b1b;
}

/* Base responsive: nav, sidebar, section */
@media (max-width: 768px) {
    .nav-left {
        gap: 1rem;
    }

    .nav-logo {
        font-size: 1.25rem;
    }

    .nav-logo i {
        font-size: 1.5rem;
    }

    .nav-greeting {
        font-size: 0.9rem;
    }

    .sidebar {
        width: 280px;
    }

    .section-title {
        font-size: 1.75rem;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .nav-greeting {
        font-size: 0.85rem;
    }

    .sidebar {
        width: 100%;
        max-width: 280px;
    }

    .btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    .error-modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .error-modal-header,
    .error-modal-body,
    .error-modal-footer {
        padding: 1rem;
    }

    .error-modal-header h3 {
        font-size: 1.25rem;
    }
}
