/**
 * Master Car - Sistema de Gestão de Locadora
 * Estilos Principais
 */

/* =====================================================
   VARIÁVEIS E RESET
   ===================================================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #94a3b8;
    --gray-light: #e2e8f0;
    --white: #ffffff;
    
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 70px;
    --border-radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark);
    background-color: #f1f5f9;
}

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

a:hover {
    color: var(--primary-dark);
}

/* =====================================================
   LAYOUT - SIDEBAR
   ===================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--dark);
    color: var(--white);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 45px;
    height: 45px;
    background: var(--primary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.sidebar-brand {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-brand span {
    color: var(--primary-light);
}

.sidebar-menu {
    padding: 15px 0;
}

.menu-category {
    padding: 10px 20px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray);
    letter-spacing: 1px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.menu-item:hover,
.menu-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    border-left-color: var(--primary);
}

.menu-item i {
    width: 24px;
    font-size: 16px;
    margin-right: 12px;
}

.menu-badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

/* =====================================================
   LAYOUT - MAIN CONTENT
   ===================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: all 0.3s ease;
}

.header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-sidebar {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--secondary);
    cursor: pointer;
    padding: 5px;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
}

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

.header-icon {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    color: var(--secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.header-icon:hover {
    background: var(--gray-light);
}

.header-icon .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.user-menu:hover {
    background: var(--light);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
}

.user-role {
    font-size: 11px;
    color: var(--gray);
    text-transform: capitalize;
}

/* =====================================================
   CONTENT AREA
   ===================================================== */
.content {
    padding: 25px;
}

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

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

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--secondary);
}

.breadcrumb a:hover {
    color: var(--primary);
}

/* =====================================================
   CARDS E WIDGETS
   ===================================================== */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-light);
    background: var(--light);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary { background: #dbeafe; color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.stat-label {
    font-size: 13px;
    color: var(--secondary);
}

.stat-change {
    font-size: 12px;
    margin-top: 5px;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

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

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

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-light);
}

.table th {
    font-weight: 600;
    color: var(--secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--light);
}

.table tbody tr:hover {
    background: var(--light);
}

.table .actions {
    display: flex;
    gap: 8px;
    position: relative;
}

.table .actions .btn {
    position: relative;
}

/* =====================================================
   BADGES E STATUS
   ===================================================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: var(--gray-light); color: var(--secondary); }
.badge-dark { background: var(--dark); color: var(--white); }

/* =====================================================
   BOTÕES
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

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

.btn-success {
    background: var(--success);
    color: var(--white);
}

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

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

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

.btn-light {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--gray-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--border-radius);
}

/* =====================================================
   FORMULÁRIOS
   ===================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled {
    background: var(--light);
    cursor: not-allowed;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-hint {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
}

.form-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

/* =====================================================
   ALERTAS
   ===================================================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.alert-info {
    background: var(--info-light);
    color: var(--info);
    border-left: 4px solid var(--info);
}

/* =====================================================
   MODAIS
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

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

.modal {
    background: var(--white);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: all 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =====================================================
   PAGINAÇÃO
   ===================================================== */
.pagination {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: var(--border-radius);
    font-size: 13px;
}

.pagination a {
    background: var(--white);
    color: var(--dark);
    border: 1px solid var(--gray-light);
}

.pagination a:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: var(--white);
}

.pagination .disabled {
    color: var(--gray);
    cursor: not-allowed;
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: var(--dark);
    color: var(--white);
    padding: 30px;
    text-align: center;
}

.login-logo {
    width: 70px;
    height: 70px;
    background: var(--primary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 32px;
    font-weight: bold;
}

.login-title {
    font-size: 22px;
    font-weight: 600;
}

.login-subtitle {
    color: var(--gray);
    font-size: 14px;
    margin-top: 5px;
}

.login-body {
    padding: 30px;
}

.login-footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--gray-light);
    font-size: 13px;
    color: var(--secondary);
}

/* =====================================================
   RESPONSIVO
   ===================================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 15px;
    }
    
    .user-info {
        display: none;
    }
    
    .content {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   UTILITÁRIOS
   ===================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }

.w-100 { width: 100%; }

.hidden { display: none !important; }

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-light);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
    color: var(--secondary);
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-light);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-date {
    font-size: 12px;
    color: var(--gray);
}

.timeline-title {
    font-weight: 600;
    margin: 4px 0;
}

.timeline-desc {
    font-size: 13px;
    color: var(--secondary);
}
