@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #0056b3;
    /* Updated to Blue */
    --primary-dark: #004494;
    --secondary-color: #00a8e8;
    /* Lighter blue/cyan for accents */
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: rgba(255, 255, 255, 0.05);
    /* Input background */
    --text-light: #f8fafc;
    --text-dim: #94a3b8;
    --accent: #38bdf8;
    --gradient-main: linear-gradient(135deg, #0056b3 0%, #00a8e8 100%);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Semantic Colors */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

a {
    text-decoration: none;
    color: var(--accent);
    transition: var(--transition);
}

a:hover {
    color: var(--secondary-color);
}

/* Header */
header {
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    color: var(--text-light);
    font-weight: 700;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

#status {
    font-weight: 600;
    color: var(--accent);
}

/* Main Content Area */
main {
    background-color: transparent;
    /* Remove white bg */
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

/* Dashboard Menu Grid */
.dashboard-menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media (min-width: 992px) {
    .dashboard-menu {
        grid-template-columns: repeat(4, 1fr);
        /* 4 columns for wider screens */
    }
}

.menu-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text-light);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
    background: linear-gradient(to bottom right, var(--bg-card), rgba(0, 86, 179, 0.1));
}

.menu-card h3 {
    margin-top: 0;
    color: var(--text-light);
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.menu-card p {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin: 0;
}

/* Specific Border Colors for Menu Cards (matching existing logic but using vars if possible) */
/* We keep the inline styles or override them with classes if provided, but inline style usually wins unless !important used. 
   Assuming inline styles for border-left color remain in HTML. Ideally, we move to classes. */

/* Section Containers */
.sucursales-section,
.edit-form,
.login-container {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-light);
}

.sucursales-section h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

/* Buttons */
.btn-new,
.btn-save,
.btn-login {
    background: var(--gradient-main);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-new:hover,
.btn-save:hover,
.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 86, 179, 0.4);
    filter: brightness(1.1);
}

.btn-edit {
    background-color: rgba(59, 130, 246, 0.2);
    /* Translucent Blue */
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.btn-edit:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-cancel,
.btn-back {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.btn-cancel:hover,
.btn-back:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border-color: var(--text-dim);
}

.btn-delete {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.btn-delete:hover {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* Forms */
.form-group label {
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

.form-group input,
.form-group select,
.form-group textarea,
.action-select {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-light);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

/* Fix for Select Options in Dark Mode */
select option {
    background-color: var(--bg-card);
    color: var(--text-light);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.action-select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.2);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: transparent;
    color: var(--text-light);
}

.data-table th {
    background-color: rgba(0, 0, 0, 0.3);
    color: var(--text-light);
    font-weight: 600;
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
}

.data-table tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Modals */
.modal-content {
    background-color: var(--bg-card) !important;
    /* Force override inline styles if needed, though usually class wins */
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: var(--shadow-lg);
    border-radius: 12px !important;
}

.close {
    color: var(--text-dim);
}

.close:hover {
    color: var(--text-light);
}

/* Login Page Specifics */
.login-page {
    background-color: var(--bg-dark);
    min-height: 100vh;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 30px;
    margin-bottom: 20px;
}

.login-footer {
    width: 100%;
    max-width: 400px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.login-footer a {
    color: var(--text-dim);
    margin: 0 10px;
    text-decoration: underline;
}

.login-footer a:hover {
    color: var(--accent);
}

.login-footer .copyright {
    display: block;
    margin-top: 10px;
    opacity: 0.7;
}

/* Branch Badge */
.branch-badge {
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.4);
}

/* Scrollbar styling for Webkit */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-card,
.sucursales-section {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Restored Modal Structural Styles */
.modal {
    display: none;
    /* Critical: hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    /* Dimmed background */
    align-items: center;
    justify-content: center;
}

/* Ensure modal content is centered and visible against dark bg */
.modal-content {
    background-color: var(--bg-card);
    /* Dark theme bg */
    margin: 10% auto;
    /* Top margin for basic centering */
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    color: var(--text-light);
    position: relative;
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: var(--text-dim);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: var(--text-light);
    text-decoration: none;
    cursor: pointer;
}

/* Branch Indicator Badge */
.branch-badge {
    background-color: #f39c12;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    vertical-align: middle;
}

.branch-badge i {
    font-size: 16px;
}