/* OliveGest - Interface Professionnelle Compacte */
:root {
    --primary: #2d5a2e;
    --primary-dark: #1e3d1f;
    --primary-light: #3d7a3e;
    --background: #f5f6f7;
    --background-dark: #1a1d1a;
    --card: #ffffff;
    --card-dark: #252825;
    --text: #1f2937;
    --text-dark: #f0f2f0;
    --text-muted: #6b7280;
    --text-muted-dark: #9ca3af;
    --border: #e2e4e6;
    --border-dark: #374151;
    --sidebar-bg: #1a2e1b;
    --sidebar-text: #d1d5db;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
}

.dark {
    --background: var(--background-dark);
    --card: var(--card-dark);
    --text: var(--text-dark);
    --text-muted: var(--text-muted-dark);
    --border: var(--border-dark);
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.4;
    font-size: 12px;
}

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

.sidebar {
    width: 180px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.2s ease;
}

.sidebar.collapsed { transform: translateX(-180px); }

.sidebar-header {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.15);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.logo i { color: #4ade80; font-size: 16px; }

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-item.active {
    background: rgba(74,222,128,0.15);
    color: #4ade80;
    border-left-color: #4ade80;
}

.nav-item i { width: 14px; text-align: center; font-size: 12px; }

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

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    border-radius: 4px;
}

.sidebar-toggle:hover { background: var(--background); color: var(--text); }

.header-right { display: flex; align-items: center; gap: 10px; }

.user-name { color: var(--text-muted); font-size: 11px; font-weight: 500; }

.btn-logout, .theme-toggle {
    background: none;
    border: none;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    border-radius: 4px;
    text-decoration: none;
}

.btn-logout:hover, .theme-toggle:hover { background: var(--background); color: var(--text); }

.main-content { flex: 1; padding: 16px; overflow-y: auto; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

.card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.card-description { color: var(--text-muted); font-size: 11px; }

/* Grid */
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-180px); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
}

/* Stats Cards */
.stat-card { display: flex; align-items: center; justify-content: space-between; }

.stat-value { font-size: 18px; font-weight: 700; line-height: 1.1; color: var(--text); }
.stat-label { color: var(--text-muted); font-size: 10px; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.3px; }

.stat-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 12px;
}

.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.yellow { background: #fef3c7; color: #d97706; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

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

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 4px 8px; font-size: 10px; }

.btn-icon { padding: 5px; width: 24px; height: 24px; justify-content: center; }

/* Tables */
.table-container { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 11px; }

th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }

th {
    font-weight: 600;
    font-size: 10px;
    color: var(--text-muted);
    background: var(--background);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

tr:hover { background: rgba(0,0,0,0.02); }

/* Forms */
.form-group { margin-bottom: 12px; }

.form-label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 11px; color: var(--text); }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11px;
    background: var(--card);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(45,90,46,0.1);
}

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.badge-green { background: #dcfce7; color: #16a34a; }
.badge-yellow { background: #fef3c7; color: #d97706; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-blue { background: #dbeafe; color: #2563eb; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--card);
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    margin: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--background);
}

.modal-title { font-size: 13px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
}

.modal-body { padding: 16px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--background);
}

/* Search */
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 120px; }

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-title { font-size: 16px; font-weight: 600; }

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2e1b 0%, #2d5a2e 100%);
    padding: 16px;
}

.login-card {
    background: var(--card);
    border-radius: 8px;
    padding: 24px;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo i { font-size: 32px; color: var(--primary); }
.login-logo h1 { font-size: 18px; margin-top: 8px; font-weight: 600; }
.login-logo p { color: var(--text-muted); font-size: 11px; margin-top: 4px; }

/* Alerts */
.alert { padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; font-size: 11px; }
.alert-error { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }

/* Parcels Grid */
.parcel-card { position: relative; }
.parcel-card .card-header { border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 8px; }
.parcel-name { font-size: 14px; font-weight: 600; }
.parcel-info { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 11px; }
.parcel-info span { color: var(--text-muted); }
.parcel-info strong { color: var(--text); font-weight: 600; }
.parcel-actions { display: flex; gap: 4px; }

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
