@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #00878a;
    --primary-hover: #006668;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 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);
    --radius: 0.5rem;
    --sidebar-width: 250px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.auth-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: center;
    color: var(--primary-color);
}

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.sidebar-nav {
    padding: 1rem 0;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item:hover, .nav-item.active {
    background-color: #eff6ff;
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.nav-item i {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 60px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
}

.user-menu a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-content {
    padding: 2rem;
    flex-grow: 1;
}

/* Typography & Titles */
.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

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

th {
    background: #f9fafb;
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background-color: #f9fafb;
}

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}

.badge.en-vigor { background: #d1fae5; color: #065f46; }
.badge.proximo { background: #fef3c7; color: #92400e; }
.badge.vencido { background: #fee2e2; color: #991b1b; }
.badge.incidencia { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3;}
.badge.cancelado { background: #f3f4f6; color: #374151; }
.badge.renovado { background: #e0e7ff; color: #3730a3; }

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

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0.5rem 0;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

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

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s;
    outline: none;
    background-color: #fff;
}

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

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 0.5rem;
}

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

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

.btn-primary:active {
    transform: translateY(1px);
}

.btn-block {
    width: 100%;
}

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

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

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

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}
/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsividad */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        left: -250px;
        width: 250px;
        transition: left 0.3s ease;
        box-shadow: none;
    }

    .sidebar.open {
        left: 0;
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .topbar {
        justify-content: space-between;
    }

    .page-content {
        padding: 1rem;
    }

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

    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .table-container div[style*="justify-content: space-between"] {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    form[style*="max-width: 600px"] {
        max-width: 100% !important;
        flex-direction: column;
    }
}
