/* ContPalma - Frontend Admin - Estilos */

/* === VARIÁVEIS === */
:root {
    --primary: #0B6E4F;
    --primary-light: #0d8a63;
    --secondary: #FFD166;
    --accent: #118AB2;
    --error: #EF476F;
    --success: #06D6A0;
    --warning: #FFA62B;
    --info: #3A86FF;
    
    --bg: #F8F9FA;
    --surface: #FFFFFF;
    --sidebar-bg: #1a1d29;
    --sidebar-hover: #252937;
    --text: #212529;
    --text-secondary: #6C757D;
    --border: #DEE2E6;
    
    --radius: 16px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* === LOGIN SCREEN === */
.login-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-screen.active {
    display: flex;
}

.login-container {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 48px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 8px 0;
}

.login-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 24px;
}

.login-error {
    background: rgba(239, 71, 111, 0.1);
    border: 2px solid var(--error);
    border-radius: 8px;
    padding: 12px;
    color: var(--error);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    display: none;
}

.login-error.show {
    display: block;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 13px;
}

.btn-large {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

/* === SIDEBAR === */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.sidebar.hidden {
    display: none;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.sidebar-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 4px 0 0 0;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background: var(--sidebar-hover);
    color: white;
    border-left: 4px solid var(--primary);
}

.nav-icon {
    font-size: 20px;
}

.nav-text {
    font-weight: 500;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === MAIN CONTENT === */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.main-content.hidden {
    display: none;
}

/* === PAGE HEADER === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* === PAGES === */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

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

.stat-icon-primary {
    background: rgba(11, 110, 79, 0.1);
    color: var(--primary);
}

.stat-icon-secondary {
    background: rgba(255, 209, 102, 0.2);
    color: #d4a339;
}

.stat-icon-accent {
    background: rgba(17, 138, 178, 0.1);
    color: var(--accent);
}

.stat-icon-success {
    background: rgba(6, 214, 160, 0.1);
    color: var(--success);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.stat-change {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* === GRID 2 COLUMNS === */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

/* === CARD === */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 24px;
}

/* === TABLES === */
table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg);
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--bg);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* === BADGES === */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.badge-success {
    background: rgba(6, 214, 160, 0.15);
    color: var(--success);
}

.badge-error {
    background: rgba(239, 71, 111, 0.15);
    color: var(--error);
}

.badge-warning {
    background: rgba(255, 166, 43, 0.15);
    color: var(--warning);
}

.badge-info {
    background: rgba(17, 138, 178, 0.15);
    color: var(--accent);
}

/* === FORMS === */
.form-group {
    margin-bottom: 20px;
}

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

.input, .select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: var(--font);
    transition: border-color 0.2s;
}

.input:focus, .select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

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

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn:active {
    transform: translateY(0);
}

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

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

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

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

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

/* === MODAL === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s;
}

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

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid var(--border);
}

.modal-footer .btn {
    flex: 1;
}

/* === LOADING OVERLAY === */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
    margin-top: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* === TOAST === */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--text);
    color: white;
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    font-size: 20px;
    font-weight: 700;
}

.toast-message {
    flex: 1;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--error);
}

.toast-warning {
    background: var(--warning);
}

.toast-info {
    background: var(--accent);
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid, .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}
