@import url('forms.css');

/* San_Prestamistas - Estilo VB6 clásico pero moderno */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 13px;
    background: #ECE9D8;
    color: #1c1c1c;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.app-header {
    background: linear-gradient(to bottom, #4A6FA5, #2D4E78);
    color: white;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #1c3a5e;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.brand { font-size: 16px; font-weight: bold; letter-spacing: 0.3px; }
.user-bar { display: flex; gap: 12px; align-items: center; }
.user { color: #fff; }
.badge {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}
.back-btn {
    color: white;
    background: rgba(0,0,0,0.2);
    padding: 4px 12px;
    border-radius: 4px;
}
.back-btn:hover { background: rgba(0,0,0,0.4); text-decoration: none; }

/* Tabs estilo VB6 */
.tabs {
    background: #ECE9D8;
    display: flex;
    border-bottom: 1px solid #aaa;
    padding: 4px 4px 0 4px;
    gap: 2px;
}
.tab {
    background: #D4CFB8;
    border: 1px solid #999;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 6px 18px;
    cursor: pointer;
    font-weight: 500;
    position: relative;
    color: #333;
}
.tab:hover { background: #C5BFA0; }
.tab-title { font-size: 13px; }
.tab-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: -1px;
    background: #F5F4EC;
    border: 1px solid #888;
    min-width: 220px;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.25);
    z-index: 100;
    padding: 4px 0;
    border-radius: 0 4px 4px 4px;
}
.tab:hover .tab-menu { display: block; }
.tab-menu ul { list-style: none; }
.tab-menu li a {
    display: block;
    padding: 6px 16px;
    color: #1c1c1c;
}
.tab-menu li a:hover { background: #316AC5; color: white; text-decoration: none; }

/* Content */
.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: #F5F4EC;
    border: 1px solid #aaa;
    border-radius: 4px;
}
.page-header h1 { font-size: 18px; color: #1c3a5e; }

/* Welcome card */
.welcome-card {
    background: white;
    border: 1px solid #aaa;
    border-radius: 6px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.welcome-card h1 { font-size: 22px; color: #1c3a5e; margin-bottom: 8px; }
.lead { color: #555; margin-bottom: 24px; font-size: 14px; }
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}
.stat {
    background: linear-gradient(to bottom, #F5F4EC, #E8E5D0);
    border: 1px solid #aaa;
    border-radius: 6px;
    padding: 18px;
    text-align: center;
    color: #1c1c1c;
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); text-decoration: none; }
.stat-label { color: #555; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 28px; font-weight: bold; color: #1c3a5e; margin-top: 4px; }

/* Data table */
.table-card {
    background: white;
    border: 1px solid #aaa;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table thead {
    background: linear-gradient(to bottom, #4A6FA5, #2D4E78);
    color: white;
}
.data-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    border-right: 1px solid rgba(255,255,255,0.15);
}
.data-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #f0f0f0;
    font-size: 12px;
}
.data-table tbody tr:nth-child(even) { background: #F9F8F2; }
.data-table tbody tr:hover { background: #E8E5D0; }
.data-table .loading { color: #888; }
.data-table .error { color: #c00; text-align: center; padding: 24px; }
.data-table .empty { color: #666; text-align: center; padding: 24px; font-style: italic; }

/* Placeholder */
.placeholder-card {
    background: white;
    border: 1px solid #aaa;
    border-radius: 6px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.placeholder-card h1 { font-size: 28px; color: #1c3a5e; margin-bottom: 12px; }
.placeholder-card .lead { font-size: 16px; margin-bottom: 6px; }
.placeholder-card .muted { color: #777; font-size: 12px; margin-bottom: 24px; }
.placeholder-card code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', monospace;
}
.actions { margin-top: 24px; }
.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #999;
    background: #D4CFB8;
    color: #1c1c1c;
}
.btn:hover { background: #C5BFA0; text-decoration: none; }
.btn-primary {
    background: linear-gradient(to bottom, #4A6FA5, #2D4E78);
    color: white;
    border-color: #1c3a5e;
}
.btn-primary:hover { background: linear-gradient(to bottom, #5A7FB5, #3D5E88); }

/* Footer */
.app-footer {
    background: #2D4E78;
    color: white;
    padding: 6px 16px;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
}

/* ===== User bar / login UI ===== */
.user-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    font-size: 12px;
    color: rgba(255,255,255,0.95);
}
.user-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
}
.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.badge-admin {
    background: #fbbf24;
    color: #78350f;
}
.badge-user {
    background: #94a3b8;
    color: #1e293b;
}
.logout-btn {
    background: rgba(220,38,38,0.85);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}
.logout-btn:hover { background: rgba(220,38,38,1); }
.back-btn {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    background: rgba(255,255,255,0.1);
}
.back-btn:hover { background: rgba(255,255,255,0.2); }

/* ===== Flashes ===== */
.flashes {
    list-style: none;
    margin: 0 0 12px 0;
    padding: 0;
}
.flashes li {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 13px;
    border-left: 4px solid;
}
.flashes li.success { background: #dcfce7; color: #166534; border-color: #16a34a; }
.flashes li.danger  { background: #fee2e2; color: #991b1b; border-color: #dc2626; }
.flashes li.warning { background: #fef3c7; color: #92400e; border-color: #d97706; }
.flashes li.info    { background: #dbeafe; color: #1e40af; border-color: #2563eb; }
.flashes li.error   { background: #fee2e2; color: #991b1b; border-color: #dc2626; }

/* ===== CRUD forms ===== */
.form-wrapper {
    background: white;
    padding: 24px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
}
.form-wrapper h2 {
    margin-top: 0;
    color: #1c3a5e;
    border-bottom: 2px solid #2D4E78;
    padding-bottom: 8px;
}
.crud-form {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}
.form-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 12px;
    align-items: center;
}
.form-row label {
    font-weight: 600;
    color: #334155;
    font-size: 12px;
}
.form-row input,
.form-row select,
.form-row textarea {
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
}
.form-row input[readonly],
.form-row input:disabled {
    background: #f1f5f9;
    color: #64748b;
}
.form-row input.pk {
    background: #fef3c7;
    font-weight: 600;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}
.btn-secondary {
    background: #e5e7eb;
    color: #1f2937;
    border: 1px solid #9ca3af;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
}
.btn-secondary:hover { background: #d1d5db; }

/* ===== Action buttons in lists ===== */
.action-btn {
    display: inline-block;
    padding: 3px 8px;
    margin: 0 2px;
    border-radius: 3px;
    font-size: 14px;
    text-decoration: none;
    border: 1px solid transparent;
}
.action-btn.edit   { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.action-btn.edit:hover   { background: #bfdbfe; }
.action-btn.delete { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.action-btn.delete:hover { background: #fecaca; }
.action-form { display: inline; }
.toolbar-btn {
    background: linear-gradient(to bottom, #4A6FA5, #2D4E78);
    color: white;
    border: 1px solid #1c3a5e;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}
.toolbar-btn:hover { background: linear-gradient(to bottom, #5A7FB5, #3D5E88); color: white; }
