/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* YakOps Color Palette */
:root {
    --primary: #0077FF;        /* Bleu glacier - logo, buttons, links */
    --secondary: #0D1B2A;      /* Bleu nuit - dark backgrounds, typography */
    --accent: #FF8A3D;         /* Orange terre yak - highlight important elements */
    --neutral-light: #F5F7FA;  /* Gris brume - light backgrounds */
    --neutral-dark: #4A5568;   /* Gris ardoise - secondary text, icons */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--secondary);
    background-color: var(--neutral-light);
}

/* Sidebar Layout */
body.sidebar-layout {
    display: flex;
    min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--secondary);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

.sidebar-header {
    padding: 1rem;
    background-color: white;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    display: block;
}

.sidebar-logo {
    max-width: 180px;
    height: auto;
    display: block;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-section-title {
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #FF8A3D;
}

.nav-menu {
    list-style: none;
}

.nav-link {
    display: block;
    padding: 0.5rem 1.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    padding-left: 2rem;
}

.sidebar-footer {
    padding: 1rem 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.logout-link {
    color: #e74c3c !important;
}

.logout-link:hover {
    background-color: rgba(231,76,60,0.1);
}

/* Main Wrapper */
.main-wrapper {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.container-header {
    background-color: #0D1B2A;
    color: white;
    padding: 1.5rem 2rem;
    margin: -2rem 0 2rem 0;
    border-radius: 8px;
}

.container-header h1 {
    color: white;
    margin: 0;
}

/* Navbar (Legacy - kept for non-sidebar pages) */
.navbar {
    background-color: var(--secondary);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.navbar-nav a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.navbar-nav a:hover {
    opacity: 0.8;
}

/* Main content */
main {
    padding: 2rem 0;
    flex: 1;
}

/* Headers */
h1 {
    color: var(--secondary);
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

h2 {
    color: var(--secondary);
    margin: 2rem 0 1rem;
    font-size: 1.5rem;
}

.page-header {
    margin-bottom: 2rem;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 1rem;
}

.btn:hover {
    background-color: #0066DD;
}

.btn-primary {
    background-color: var(--accent);
}

.btn-primary:hover {
    background-color: #E67A2D;
}

.btn-danger {
    background-color: #e74c3c;
}

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

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* Forms */
.form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 600px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Tables */
.table {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
    margin: 0 auto;
}

.table table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.table thead {
    background-color: var(--secondary);
    color: white;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    white-space: nowrap;
}

.table tbody tr {
    border-bottom: 1px solid #ecf0f1;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table a {
    color: var(--primary);
    text-decoration: none;
}

.table a:hover {
    text-decoration: underline;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: capitalize;
}

.badge-open,
.badge-active {
    background-color: var(--primary);
    color: white;
}

.badge-in_progress {
    background-color: var(--accent);
    color: white;
}

.badge-resolved,
.badge-completed {
    background-color: #27ae60;
    color: white;
}

.badge-closed,
.badge-cancelled {
    background-color: var(--neutral-dark);
    color: white;
}

.badge-on_hold {
    background-color: var(--accent);
    color: white;
}

.badge-low {
    background-color: var(--neutral-dark);
    color: white;
}

.badge-medium {
    background-color: var(--primary);
    color: white;
}

.badge-high {
    background-color: var(--accent);
    color: white;
}

.badge-urgent {
    background-color: #e74c3c;
    color: white;
}

/* Grid layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    color: var(--neutral-dark);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--secondary);
    margin: 1rem 0;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ecf0f1;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h2 {
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* Detail card */
.detail-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.detail-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid #ecf0f1;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row strong {
    display: inline-block;
    width: 150px;
    color: var(--neutral-dark);
}

/* Section */
.section {
    margin-bottom: 2rem;
}

/* Flash messages */
.flash-messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Footer */
.footer {
    background-color: var(--secondary);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Responsive design */
@media (max-width: 768px) {
    /* Sidebar responsive */
    .sidebar {
        width: 200px;
    }

    .main-wrapper {
        margin-left: 200px;
    }

    .sidebar-logo {
        max-width: 140px;
    }

    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar-nav {
        width: 100%;
        justify-content: center;
        gap: 1rem;
    }

    .header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .form {
        padding: 1.5rem;
    }

    .detail-row strong {
        display: block;
        margin-bottom: 0.25rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    /* Hide sidebar on very small screens, show hamburger menu */
    .sidebar {
        width: 60px;
    }

    .sidebar-logo {
        max-width: 40px;
    }

    .sidebar-brand,
    .nav-section-title,
    .nav-link {
        font-size: 0.875rem;
    }

    .nav-section-title {
        padding: 0.5rem 0.5rem;
    }

    .nav-link {
        padding: 0.75rem 0.5rem;
    }

    .main-wrapper {
        margin-left: 60px;
    }

    .container {
        padding: 0 10px;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}
