/* ============================================
   SISTEMA MONITORIZARE SERVICE AUTO v2.0
   Mobile-first, Compact Design (60/40)
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 10px;
}

/* ============================================
   HEADER
   ============================================ */

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 0;
}

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

header h1 {
    font-size: 18px;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav-main {
    background: #2c3e50;
    margin-bottom: 10px;
    overflow-x: auto;
    white-space: nowrap;
}

.nav-main .container {
    display: flex;
    gap: 0;
}

.nav-main a {
    color: white;
    text-decoration: none;
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.nav-main a.active {
    background: #34495e;
    border-bottom-color: #667eea;
}

.nav-main a:hover {
    background: #34495e;
}

.nav-sub {
    background: #ecf0f1;
    margin-bottom: 10px;
    overflow-x: auto;
    white-space: nowrap;
}

.nav-sub .container {
    display: flex;
    gap: 0;
}

.nav-sub a {
    color: #2c3e50;
    text-decoration: none;
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 2px solid transparent;
}

.nav-sub a.active {
    background: white;
    border-bottom-color: #667eea;
    font-weight: 600;
}

/* ============================================
   TOOLBAR (Căutare + Adaugă)
   ============================================ */

.toolbar {
    background: white;
    padding: 10px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.toolbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-result-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-plate {
    font-weight: 600;
    font-size: 15px;
    color: #2c3e50;
}

.search-details {
    font-size: 13px;
    color: #7f8c8d;
    margin-top: 2px;
}

.search-location {
    color: #667eea;
    margin-left: 8px;
}

.search-no-results {
    padding: 12px;
    text-align: center;
    color: #95a5a6;
    font-size: 13px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-add {
    background: #27ae60;
    color: white;
}

.btn-add:hover {
    background: #229954;
}

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

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

/* ============================================
   LISTĂ MAȘINI (60/40 mobil)
   ============================================ */

.cars-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.car-card {
    background: white;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.car-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.car-left {
    flex: 0 0 60%;
}

.car-right {
    flex: 0 0 calc(40% - 12px);
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.car-plate {
    font-size: 17px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.badge-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-avizat {
    background: #3498db;
    color: white;
}

.badge-iesit {
    background: #27ae60;
    color: white;
}

.badge-stored {
    background: #95a5a6;
    color: white;
}

.badge-replacement {
    background: #e67e22;
    color: white;
}

.car-model {
    font-size: 14px;
    color: #34495e;
    margin-bottom: 4px;
}

.car-category {
    font-size: 13px;
    color: #667eea;
    margin-bottom: 3px;
}

.car-last-event {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    padding: 4px 6px;
    background: #f8f9fa;
    border-radius: 3px;
    font-style: italic;
}

.car-last-event.manager-note {
    background: #ffe5e5;
    border-left: 3px solid #dc3545;
    color: #721c24;
    font-style: normal;
    font-weight: 600;
}

.car-meta {
    font-size: 13px;
    color: #7f8c8d;
}

.car-replacement-info {
    font-size: 12px;
    color: #667eea;
    margin-top: 4px;
}

/* ============================================
   TIME BADGES (dreapta, 40%)
   ============================================ */

.time-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 8px;
    border-radius: 4px;
    text-align: center;
    width: 110px;
}

.time-value {
    font-size: 14px;
    font-weight: 700;
}

.time-label {
    font-size: 10px;
    opacity: 0.9;
    margin-top: 2px;
}

.time-replacement {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.time-service {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
}

.btn-page {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}

.btn-page:hover {
    background: #5568d3;
}

.page-info {
    font-size: 14px;
    color: #7f8c8d;
}

/* ============================================
   CAR VIEW - HEADER
   ============================================ */

.car-header {
    background: white;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.car-header h2 {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 6px;
}

.car-model-large {
    font-size: 15px;
    color: #7f8c8d;
}

/* ============================================
   CAR VIEW - 2 COLOANE
   ============================================ */

.car-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .car-details-grid {
        grid-template-columns: 1fr;
    }
}

.car-info-col,
.car-actions-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================================
   INFO BOX
   ============================================ */

.info-box {
    background: white;
    padding: 14px;
    border-radius: 6px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.info-label {
    font-size: 13px;
    color: #7f8c8d;
}

.info-value {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.info-value.highlight {
    color: #e74c3c;
}

/* ============================================
   ACTION BOX
   ============================================ */

.action-box {
    background: white;
    padding: 14px;
    border-radius: 6px;
    max-width: 500px;
}

.action-box h3 {
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 8px;
}

.action-box form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-box select,
.action-box input[type="text"],
.action-box textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.action-box select {
    cursor: pointer;
    background-color: white;
    padding: 12px 14px;
    font-size: 15px;
    min-height: 44px;
}

.action-box select:hover {
    border-color: #667eea;
}

.action-box textarea {
    resize: vertical;
    min-height: 60px;
}

.action-box .btn {
    align-self: flex-start;
    padding: 8px 20px;
    font-size: 13px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 10px;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.active-replacement-info {
    background: #ecf0f1;
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 8px;
}

.replacement-stats {
    font-size: 14px;
    color: #2c3e50;
    margin-top: 8px;
}

.replacement-history-list {
    list-style: none;
    padding: 10px 0 0 0;
}

.replacement-history-list li {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.replacement-history-list li:last-child {
    border-bottom: none;
}

details {
    margin-top: 10px;
}

summary {
    cursor: pointer;
    font-size: 13px;
    color: #667eea;
    padding: 4px 0;
}

.danger-zone {
    border: 1px solid #e74c3c;
}

/* ============================================
   ISTORIC SMS STYLE
   ============================================ */

.history-section {
    background: white;
    padding: 16px;
    border-radius: 6px;
}

.history-section h3 {
    font-size: 17px;
    color: #2c3e50;
    margin-bottom: 16px;
}

.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    max-width: 70%;
    padding: 10px 12px;
    border-radius: 8px;
}

.history-left {
    align-self: flex-start;
    background: #ecf0f1;
    color: #2c3e50;
}

.history-right {
    align-self: flex-end;
    background: #667eea;
    color: white;
}

.history-manager {
    background: #dc3545 !important;
    font-weight: 500;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.history-time {
    font-size: 10px;
    opacity: 0.7;
}

.history-user {
    font-size: 12px;
    font-weight: 600;
}

.history-content {
    font-size: 13px;
    line-height: 1.4;
}

.note-category-time {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.8;
    margin-bottom: 6px;
}

/* ============================================
   FORMS
   ============================================ */

.car-form {
    background: white;
    padding: 20px;
    border-radius: 6px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ============================================
   MESSAGES
   ============================================ */

.success,
.error {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

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

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

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
    font-size: 15px;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    font-size: 24px;
    color: #2c3e50;
    margin-bottom: 8px;
    text-align: center;
}

.login-container h2 {
    font-size: 16px;
    color: #7f8c8d;
    margin-bottom: 24px;
    text-align: center;
    font-weight: 400;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    header h1 {
        font-size: 16px;
    }

    .car-plate {
        font-size: 16px;
    }

    .car-model {
        font-size: 13px;
    }

    .car-meta {
        font-size: 12px;
    }

    .time-value {
        font-size: 13px;
    }

    .time-label {
        font-size: 9px;
    }

    .info-label,
    .info-value {
        font-size: 13px;
    }

    .history-content {
        font-size: 12px;
    }
}

/* ============================================
   CAR VIEW COMPACT HEADER
   ============================================ */

.car-header-compact {
    background: white;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    gap: 16px;
}

.car-header-left {
    flex: 1;
}

.car-header-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.car-plate-big {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.car-model-big {
    font-size: 15px;
    color: #34495e;
    margin-bottom: 4px;
}

.car-location-big {
    font-size: 14px;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 12px;
}

.car-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.info-item {
    font-size: 12px;
}

.info-label-sm {
    color: #7f8c8d;
    display: block;
    font-size: 11px;
}

.info-value-sm {
    color: #2c3e50;
    font-weight: 600;
    display: block;
    font-size: 13px;
}

.car-actions-single-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.car-actions-single-row .action-box {
    flex: 1;
}

.history-section h3 {
    font-size: 15px;
    color: #2c3e50;
    margin-bottom: 12px;
}

@media (max-width: 768px) {
    .car-header-compact {
        padding: 12px;
        gap: 12px;
    }

    .car-header-right {
        min-width: 100px;
        gap: 6px;
    }

    .time-badge {
        padding: 6px;
    }

    .time-value {
        font-size: 13px;
    }

    .time-label {
        font-size: 9px;
    }

    .car-plate-big {
        font-size: 18px;
    }

    .car-model-big {
        font-size: 14px;
    }

    .car-location-big {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .car-info-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .info-label-sm {
        font-size: 10px;
    }

    .info-value-sm {
        font-size: 12px;
    }

    .car-actions-single-row {
        flex-direction: column;
    }

    .action-box {
        max-width: 100% !important;
    }
}

/* ============================================
   BUTTONS - SECONDARY STYLE
   ============================================ */

.btn-secondary,
a.btn-secondary {
    background: #95a5a6;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-block;
}

.btn-secondary:hover,
a.btn-secondary:hover {
    background: #7f8c8d;
}
