/* =====================================================
   KEPLER DEB - Sistema de Gestión de Débitos Automáticos
   Estilos principales
   ===================================================== */

:root {
    --primary: #1a365d;
    --primary-light: #2c5282;
    --secondary: #4a5568;
    --accent: #ed8936;
    --success: #38a169;
    --warning: #d69e2e;
    --danger: #e53e3e;
    --light: #f7fafc;
    --dark: #1a202c;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(26, 54, 93, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 20px;
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 3px;
}

.sidebar-header .subtitle {
    font-size: 0.7rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-header .logo-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.sidebar-nav {
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.nav-section {
    margin-bottom: 10px;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--accent);
}

.nav-link.active {
    background: rgba(237, 137, 54, 0.2);
    color: var(--accent);
    border-left-color: var(--accent);
}

.nav-link i {
    width: 22px;
    margin-right: 10px;
    font-size: 1rem;
}

/* Contenido principal */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    background: var(--light);
    min-height: 100vh;
}

/* Header del contenido */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.content-header h2 {
    font-size: 1.75rem;
    color: var(--primary);
    font-weight: 600;
}

.content-header .breadcrumb {
    font-size: 0.85rem;
    color: var(--secondary);
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    padding: 18px 25px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 25px;
}

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

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

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-valid {
    border-color: var(--success);
}

select.form-control {
    cursor: pointer;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-text {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 5px;
}

.invalid-feedback {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    gap: 8px;
}

.btn i {
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.4);
}

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

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

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

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 15px 35px;
    font-size: 1.1rem;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Tablas */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--light);
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.table tbody tr:hover {
    background: #f1f5f9;
}

.table .actions {
    white-space: nowrap;
}

.table .actions .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(56, 161, 105, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(214, 158, 46, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(229, 62, 62, 0.15);
    color: var(--danger);
}

.badge-info {
    background: rgba(49, 130, 206, 0.15);
    color: #3182ce;
}

.badge-credito {
    background: rgba(49, 130, 206, 0.15);
    color: #3182ce;
}

.badge-debito {
    background: rgba(128, 90, 213, 0.15);
    color: #805ad5;
}

/* Alertas */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert i {
    font-size: 1.25rem;
}

.alert-success {
    background: rgba(56, 161, 105, 0.1);
    border: 1px solid rgba(56, 161, 105, 0.3);
    color: #22543d;
}

.alert-warning {
    background: rgba(214, 158, 46, 0.1);
    border: 1px solid rgba(214, 158, 46, 0.3);
    color: #744210;
}

.alert-danger {
    background: rgba(229, 62, 62, 0.1);
    border: 1px solid rgba(229, 62, 62, 0.3);
    color: #742a2a;
}

.alert-info {
    background: rgba(49, 130, 206, 0.1);
    border: 1px solid rgba(49, 130, 206, 0.3);
    color: #2a4365;
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.credito {
    background: linear-gradient(135deg, #3182ce 0%, #2b6cb0 100%);
}

.stat-icon.debito {
    background: linear-gradient(135deg, #805ad5 0%, #6b46c1 100%);
}

.stat-icon.socios {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.stat-icon.monto {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--secondary);
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 50px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

.login-header .logo-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.login-header h1 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 5px;
}

.login-header p {
    color: var(--secondary);
    font-size: 0.9rem;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 25px;
}

.tab {
    padding: 15px 25px;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s ease;
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}

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

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* User info en sidebar */
.user-info {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.user-info .user-name {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 0.95rem;
}

.user-info .user-role {
    font-size: 0.75rem;
    opacity: 0.7;
    text-transform: capitalize;
    margin-bottom: 8px;
}

.user-info .logout-link {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.8rem;
    margin-right: 10px;
}

.user-info .logout-link:hover {
    text-decoration: underline;
}

/* Checkbox toggle */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--success);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Loader */
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 100;
}

/* Número de tarjeta con formato */
.card-number {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    letter-spacing: 2px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 25px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--secondary);
    transition: all 0.3s;
}

.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--secondary);
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-state h3 {
    margin-bottom: 10px;
}
