/* ============================================
   DELY - CSS
   Profissional | Branco + Azul | Sem emoji
   ============================================ */

:root {
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: #EFF6FF;
    --primary-50: #EFF6FF;
    --primary-100: #DBEAFE;
    --primary-600: #2563EB;
    --primary-700: #1D4ED8;
    --primary-800: #1E40AF;

    --sidebar-bg: #0F172A;
    --sidebar-hover: #1E293B;
    --sidebar-text: #94A3B8;
    --sidebar-active: #3B82F6;

    --white: #FFFFFF;
    --body-bg: #F1F5F9;
    --card-bg: #FFFFFF;

    --text: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;
    --text-light: #94A3B8;

    --border: #E2E8F0;
    --border-light: #F1F5F9;

    --success: #16A34A;
    --success-light: #F0FDF4;
    --danger: #DC2626;
    --danger-light: #FEF2F2;
    --warning: #D97706;
    --warning-light: #FFFBEB;

    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.04);
    --transition: all .2s ease;

    --sidebar-width: 260px;
    --header-height: 64px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--body-bg);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); font-size: 14px; }

/* ---- LOGIN ---- */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--body-bg);
}

.login-container { width: 100%; max-width: 420px; padding: 20px; }

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    border: 1px solid var(--border);
}

.login-header { text-align: center; margin-bottom: 32px; }

.login-logo {
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}

.login-header h1 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-header p { color: var(--text-muted); font-size: 14px; }
.login-form { display: flex; flex-direction: column; gap: 20px; }
.login-footer { text-align: center; margin-top: 24px; color: var(--text-light); font-size: 12px; }

/* ---- FORMS ---- */

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.input-icon { position: relative; }
.input-icon i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-light); font-size: 14px; pointer-events: none;
}
.input-icon input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--text);
    outline: none;
    transition: var(--transition);
}
.input-icon input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.input-icon input::placeholder { color: var(--text-light); }

/* ---- BUTTONS ---- */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 10px 20px; border-radius: var(--radius);
    font-size: 14px; font-weight: 600;
    transition: var(--transition); border: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-secondary { background: var(--white); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--body-bg); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #B91C1C; }
.btn-block { width: 100%; padding: 12px 20px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--primary-light); border-color: var(--primary); }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--border); }
.btn-danger-outline:hover { background: var(--danger-light); border-color: var(--danger); }

/* ---- ALERTS ---- */

.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #FECACA; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #BBF7D0; }

/* ---- SIDEBAR ---- */

.admin-page { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column;
    z-index: 100; transition: var(--transition);
}
.sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header {
    display: flex; align-items: center; gap: 12px;
    padding: 20px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo {
    width: 40px; height: 40px;
    background: var(--primary); color: var(--white);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.sidebar-brand { font-size: 15px; font-weight: 700; color: var(--white); white-space: nowrap; }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }

.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: var(--radius);
    color: var(--sidebar-text); font-size: 14px; font-weight: 500;
    transition: var(--transition);
}
.sidebar-link:hover { background: var(--sidebar-hover); color: var(--white); }
.sidebar-link.active { background: rgba(59,130,246,.15); color: var(--sidebar-active); }
.sidebar-link.active i { color: var(--sidebar-active); }
.sidebar-link i { width: 20px; text-align: center; font-size: 15px; }

.sidebar-footer {
    padding: 16px; border-top: 1px solid rgba(255,255,255,.06);
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar { font-size: 28px; color: var(--sidebar-text); line-height: 1; }
.sidebar-user-info { display: flex; flex-direction: column; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--white); }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-text); }
.sidebar-logout {
    color: var(--sidebar-text); font-size: 16px; padding: 8px;
    border-radius: var(--radius); transition: var(--transition);
}
.sidebar-logout:hover { background: rgba(220,38,38,.15); color: #F87171; }

/* ---- MAIN CONTENT ---- */

.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; transition: var(--transition); }
.main-content.expanded { margin-left: 0; }

.main-header {
    height: var(--header-height);
    background: var(--white); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.sidebar-toggle {
    color: var(--text-muted); font-size: 18px; padding: 8px;
    border-radius: var(--radius); transition: var(--transition); display: none;
}
.sidebar-toggle:hover { background: var(--body-bg); color: var(--text); }
.page-title { font-size: 18px; font-weight: 700; color: var(--text); }
.main-body { padding: 24px; }

/* ---- DASHBOARD ---- */

.dashboard-welcome { margin-bottom: 24px; }
.dashboard-welcome h3 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.dashboard-welcome p { color: var(--text-muted); font-size: 14px; }

.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

.dashboard-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
    transition: var(--transition);
}
.dashboard-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.dashboard-card-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.dashboard-card-icon.blue { background: var(--primary-50); color: var(--primary); }

.dashboard-card-info { flex: 1; }
.dashboard-card-info h4 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.dashboard-card-info p { font-size: 13px; color: var(--text-muted); }
.dashboard-card-arrow { color: var(--text-light); font-size: 14px; transition: var(--transition); }
.dashboard-card:hover .dashboard-card-arrow { color: var(--primary); transform: translateX(4px); }

/* ---- CONTENT CARD ---- */

.content-card {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
}
.content-card-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.search-box { position: relative; flex: 1; max-width: 400px; }
.search-box i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-light); font-size: 14px;
}
.search-box input {
    width: 100%; padding: 10px 14px 10px 40px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--body-bg); color: var(--text); outline: none;
    transition: var(--transition);
}
.search-box input:focus { border-color: var(--primary); background: var(--white); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.search-box input::placeholder { color: var(--text-light); }

/* ---- TABLE ---- */

.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table thead th {
    padding: 12px 20px; text-align: left;
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-muted); background: var(--body-bg);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody td {
    padding: 14px 20px; font-size: 14px; color: var(--text);
    border-bottom: 1px solid var(--border-light); vertical-align: middle;
}
.table tbody tr:hover { background: var(--primary-50); }
.table tbody tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 6px; }
.text-center { text-align: center !important; }
.text-muted { color: var(--text-muted) !important; }

/* ---- STATUS BADGE ---- */

.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600; letter-spacing: .3px;
}
.status-ativo { background: var(--success-light); color: var(--success); }
.status-inativo { background: var(--danger-light); color: var(--danger); }

.btn-success-outline { background: transparent; color: var(--success); border: 1px solid var(--border); }
.btn-success-outline:hover { background: var(--success-light); border-color: var(--success); }

.table tbody tr.row-inativo td { opacity: .55; }
.table tbody tr.row-inativo:hover td { opacity: .75; }
.table tbody tr.row-inativo .status-badge { opacity: 1; }
.table tbody tr.row-inativo .table-actions { opacity: 1; }

/* ---- PERIODO BADGE ---- */

.periodo-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; letter-spacing: .3px; white-space: nowrap;
}
.periodo-sem { background: var(--body-bg); color: var(--text-light); }
.periodo-ok { background: var(--success-light); color: var(--success); }
.periodo-atraso { background: var(--warning-light); color: var(--warning); }
.periodo-vencido { background: var(--danger-light); color: var(--danger); }

/* ---- PERIODO TIPO SELECTOR ---- */

.periodo-tipo-selector { display: flex; gap: 8px; }
.periodo-tipo-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; border-radius: var(--radius);
    border: 2px solid var(--border); background: var(--white);
    color: var(--text-muted); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.periodo-tipo-btn:hover { border-color: var(--primary); color: var(--primary); }
.periodo-tipo-btn.active {
    border-color: var(--primary); background: var(--primary-light);
    color: var(--primary);
}

/* ---- PERIODO RESUMO ---- */

.periodo-resumo {
    background: var(--primary-light); border: 1px solid var(--primary-100);
    border-radius: var(--radius); padding: 12px 16px;
    font-size: 13px; color: var(--text-secondary); line-height: 1.8;
}

.form-hint { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ---- EMPTY STATE ---- */

.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 20px; text-align: center;
}
.empty-state i { font-size: 48px; color: var(--border); margin-bottom: 16px; }
.empty-state h4 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: var(--text-muted); }

/* ---- MODAL ---- */

.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,.5); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--card-bg); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto;
    transform: translateY(20px) scale(.97); transition: var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-sm { max-width: 400px; }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
    width: 32px; height: 32px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); transition: var(--transition);
}
.modal-close:hover { background: var(--body-bg); color: var(--text); }

.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.modal-footer {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border);
}

/* ---- TOAST ---- */

.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--sidebar-bg); color: var(--white);
    padding: 14px 20px; border-radius: var(--radius);
    font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
    z-index: 300; transform: translateY(20px); opacity: 0;
    transition: all .3s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid var(--danger); }

/* ---- SPINNER ---- */

.spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3); border-top-color: var(--white);
    border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- RESPONSIVE ---- */

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.collapsed { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .content-card-header { flex-direction: column; align-items: stretch; }
    .search-box { max-width: 100%; }
    .modal { margin: 16px; }
}

/* ---- MODAL BACKDROP ---- */
.modal-backdrop {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
}
