/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --surface: #ffffff;
    --background: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navbar */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.logo {
    font-size: 20px;
    color: var(--primary);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-size: 14px;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 14px;
    color: var(--text-muted);
}

.btn-logout {
    background: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 64px);
    padding: 2rem 0;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    position: relative;
    animation: slideIn 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid;
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-left-color: var(--success);
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: var(--danger);
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-left-color: var(--primary);
}

.alert-close {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

.auth-title {
    text-align: center;
    color: var(--text);
    margin-bottom: 2rem;
    font-size: 24px;
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s ease;
    background: var(--surface);
}

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

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
}

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

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 14px;
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-link a:hover {
    text-decoration: underline;
}

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

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

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

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

.btn-secondary:hover {
    background: #475569;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.btn-danger {
    color: var(--danger) !important;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-warning {
    color: var(--warning) !important;
}

/* Dashboard */
.page-title {
    color: var(--text);
    margin-bottom: 2rem;
    font-size: 28px;
    font-weight: 700;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card-icon {
    font-size: 48px;
    margin-bottom: 1rem;
    color: var(--primary);
    opacity: 0.8;
}

.dashboard-card h3 {
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 18px;
    font-weight: 600;
}

.dashboard-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 14px;
    line-height: 1.5;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.card-header {
    padding: 1.25rem 1.5rem;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-actions .btn-icon {
    color: rgba(255, 255, 255, 0.9);
    padding: 0.25rem;
}

.card-actions .btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.card-body {
    padding: 1.5rem;
}

.number-phone {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bases-count {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Table */
.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.data-table thead {
    background: #f8fafc;
}

.data-table th,
.data-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table th {
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.025em;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table td {
    color: var(--text);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    background: var(--surface);
    margin: 2rem auto;
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius);
    animation: slideUp 0.3s ease;
    border: 1px solid var(--border);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.modal-large {
    max-width: 700px;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-header h2 {
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
    padding: 0.25rem;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Associations */
.associations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
}

.association-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.association-header {
    padding: 1.25rem 1.5rem;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.association-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.phone-badge {
    background: var(--primary);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

.association-body {
    padding: 1.5rem;
}

.association-body h4 {
    color: var(--text);
    margin-bottom: 1rem;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.bases-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bases-list li {
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.base-name {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.base-description {
    display: block;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.no-bases {
    color: var(--text-muted);
    font-style: italic;
    font-size: 14px;
    text-align: center;
    padding: 2rem;
}

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

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Font Awesome specific styles */
.fas, .far, .fab {
    line-height: 1;
}

.btn .fas {
    margin-right: 0.5rem;
}

.stat-label .fas {
    margin-right: 0.25rem;
    font-size: 10px;
}

.number-phone .fas,
.bases-count .fas {
    margin-right: 0.5rem;
    color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .dashboard-grid,
    .cards-grid,
    .associations-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .auth-container {
        padding: 1rem;
    }
    
    .auth-card {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-title {
        font-size: 24px;
    }
}