/* ============================================================
   SISTEMA DE REPARTOS - COMPUERTAS HIDRAULICA
   ============================================================ */

/* ---------- Google Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- Variables CSS ---------- */
:root {
    --deep-ocean:   #d16004;
    --ocean-blue:   #e38425;
    --medium-blue:  #d16004;
    --sky-blue:     #f08001;
    --light-blue:   #f2982d;
    --aqua:         #f5af59;
    --seafoam:      #f7c685;
    --pale-aqua:    #faddb1;
    --ice:          #fcf4de;
    --white:        #ffffff;
    --body-bg:      #fffbf2;
    --card-shadow:  0 4px 24px rgba(120, 54, 0, 0.08);
    --card-hover:   0 8px 32px rgba(120, 54, 0, 0.14);
    --border-radius: 12px;
    --transition:   all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--body-bg);
    color: #1a2332;
    min-height: 100vh;
    line-height: 1.6;
}

/* ---------- Navbar ---------- */
.navbar-hidraulica {
    background: linear-gradient(135deg, var(--deep-ocean) 0%, var(--ocean-blue) 50%, var(--medium-blue) 100%);
    box-shadow: 0 4px 20px rgba(120, 54, 0, 0.25);
    padding: 0.6rem 0;
    position: sticky;
    top: 0;
    z-index: 1050;
}

.navbar-hidraulica .navbar-brand {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--white) !important;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-hidraulica .navbar-brand .brand-icon {
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 1.1rem;
}

.navbar-hidraulica .nav-link {
    color: rgba(255,255,255,0.8) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: var(--transition);
    margin: 0 2px;
}

.navbar-hidraulica .nav-link:hover,
.navbar-hidraulica .nav-link.active {
    color: var(--white) !important;
    background: rgba(255,255,255,0.12);
}

.navbar-hidraulica .nav-link .bi {
    margin-right: 4px;
}

.navbar-user-badge {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--white);
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------- Login Page ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--deep-ocean) 0%, var(--ocean-blue) 30%, var(--medium-blue) 60%, var(--sky-blue) 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(245, 175, 89,0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
    animation: pulse-glow 6s ease-in-out infinite;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(247, 198, 133,0.1) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
    border-radius: 50%;
    animation: pulse-glow 8s ease-in-out infinite reverse;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50%      { transform: scale(1.15); opacity: 1; }
}

.login-card {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 10;
}

.login-card h2 {
    color: var(--white);
    font-weight: 800;
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
}

.login-card .subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-card .form-label {
    color: rgba(255,255,255,0.7);
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.login-card .form-control {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--white);
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    transition: var(--transition);
}

.login-card .form-control:focus {
    background: rgba(255,255,255,0.12);
    border-color: var(--aqua);
    box-shadow: 0 0 0 3px rgba(245, 175, 89,0.2);
    color: var(--white);
}

.login-card .form-control::placeholder {
    color: rgba(255,255,255,0.35);
}

.login-card .btn-login {
    background: linear-gradient(135deg, var(--light-blue), var(--aqua));
    border: none;
    color: var(--deep-ocean);
    font-weight: 700;
    padding: 0.75rem;
    border-radius: 10px;
    font-size: 1rem;
    width: 100%;
    transition: var(--transition);
    letter-spacing: 0.3px;
}

.login-card .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(242, 152, 45,0.4);
}

/* ---------- Page Content ---------- */
.page-wrapper {
    max-width: 1300px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-weight: 800;
    font-size: 1.8rem;
    color: var(--deep-ocean);
    letter-spacing: -0.5px;
}

.page-header p {
    color: #5a6a7a;
    font-size: 0.95rem;
    margin-top: 0.3rem;
}

/* ---------- Cards ---------- */
.card-hidraulica {
    background: var(--white);
    border: 1px solid rgba(120, 54, 0,0.06);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card-hidraulica:hover {
    box-shadow: var(--card-hover);
}

.card-hidraulica .card-header {
    background: linear-gradient(135deg, var(--deep-ocean) 0%, var(--ocean-blue) 100%);
    color: var(--white);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 1rem 1.25rem;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-hidraulica .card-body {
    padding: 1.5rem;
}

/* ---------- Stats Cards (compuerta data) ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border: 1px solid rgba(120, 54, 0,0.06);
    border-radius: var(--border-radius);
    padding: 1.2rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card.turno::before       { background: var(--medium-blue); }
.stat-card.perdida::before     { background: #e74c3c; }
.stat-card.neto::before        { background: #27ae60; }
.stat-card.has-emp::before     { background: var(--sky-blue); }
.stat-card.has-uso::before     { background: var(--aqua); }
.stat-card.tiempo::before      { background: #f39c12; }
.stat-card.usr-emp::before     { background: #8e44ad; }
.stat-card.usr-uso::before     { background: #2ecc71; }

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-hover);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #7a8a9a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--deep-ocean);
}

.stat-card .stat-unit {
    font-size: 0.8rem;
    font-weight: 500;
    color: #7a8a9a;
    margin-left: 4px;
}

/* ---------- Data Table ---------- */
.table-hidraulica {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-hidraulica thead th {
    background: var(--medium-blue);
    color: var(--white);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.85rem 1rem;
    border: none;
    white-space: nowrap;
}

.table-hidraulica thead th:first-child {
    border-radius: 10px 0 0 0;
}

.table-hidraulica thead th:last-child {
    border-radius: 0 10px 0 0;
}

.table-hidraulica tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
}

.table-hidraulica tbody tr {
    transition: var(--transition);
}

.table-hidraulica tbody tr:hover {
    background: rgba(240, 128, 1,0.04);
}

.table-hidraulica tbody tr:last-child td {
    border-bottom: none;
}

/* Row highlight (for search results) */
.table-hidraulica tbody tr.row-highlight {
    background: linear-gradient(90deg, rgba(245, 175, 89,0.12) 0%, rgba(242, 152, 45,0.06) 100%) !important;
    border-left: 4px solid var(--light-blue);
    animation: highlight-pulse 2s ease-in-out;
}

@keyframes highlight-pulse {
    0%   { background: rgba(245, 175, 89,0.25); }
    100% { background: rgba(245, 175, 89,0.12); }
}

/* ---------- Badges ---------- */
.badge-riega-si {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 0.3em 0.7em;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-riega-no {
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
    color: white;
    padding: 0.3em 0.7em;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ---------- Selector Card ---------- */
.selector-section {
    background: var(--white);
    border: 1px solid rgba(120, 54, 0,0.06);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.selector-section h5 {
    font-weight: 700;
    color: var(--deep-ocean);
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
}

.selector-section .form-select,
.selector-section .form-control {
    border-radius: 10px;
    border: 1.5px solid #dfe6ee;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.selector-section .form-select:focus,
.selector-section .form-control:focus {
    border-color: var(--light-blue);
    box-shadow: 0 0 0 3px rgba(242, 152, 45,0.12);
}

/* ---------- Buttons ---------- */
.btn-water {
    background: linear-gradient(135deg, var(--medium-blue), var(--sky-blue));
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-water:hover {
    background: linear-gradient(135deg, var(--ocean-blue), var(--medium-blue));
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(204, 102, 0,0.3);
}

.btn-water-outline {
    background: transparent;
    border: 2px solid var(--medium-blue);
    color: var(--medium-blue);
    font-weight: 600;
    padding: 0.55rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-water-outline:hover {
    background: var(--medium-blue);
    color: white;
}

.btn-action {
    padding: 0.35rem 0.6rem;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 500;
    border: none;
    transition: var(--transition);
}

.btn-action.edit {
    background: rgba(204, 102, 0,0.1);
    color: var(--medium-blue);
}

.btn-action.edit:hover {
    background: var(--medium-blue);
    color: white;
}

.btn-action.delete {
    background: rgba(231,76,60,0.1);
    color: #e74c3c;
}

.btn-action.delete:hover {
    background: #e74c3c;
    color: white;
}

/* ---------- Compuerta Header ---------- */
.compuerta-header {
    background: linear-gradient(135deg, var(--deep-ocean) 0%, var(--ocean-blue) 50%, var(--medium-blue) 100%);
    border-radius: var(--border-radius);
    padding: 2rem;
    color: white;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.compuerta-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(245, 175, 89,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.compuerta-header h2 {
    font-weight: 800;
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
    position: relative;
    z-index: 2;
}

.compuerta-header .breadcrumb-path {
    font-size: 0.85rem;
    opacity: 0.7;
    position: relative;
    z-index: 2;
}

.compuerta-header .breadcrumb-path .bi {
    font-size: 0.7rem;
    margin: 0 6px;
}

.compuerta-number {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3.5rem;
    font-weight: 900;
    opacity: 0.12;
    z-index: 1;
}

/* ---------- Dashboard Cards ---------- */
.dash-card {
    background: var(--white);
    border: 1px solid rgba(120, 54, 0,0.06);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.dash-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover);
    color: inherit;
    text-decoration: none;
}

.dash-card .dash-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.4rem;
    color: white;
}

.dash-card .dash-icon.depto   { background: linear-gradient(135deg, var(--deep-ocean), var(--ocean-blue)); }
.dash-card .dash-icon.canal   { background: linear-gradient(135deg, var(--medium-blue), var(--sky-blue)); }
.dash-card .dash-icon.ramo    { background: linear-gradient(135deg, var(--light-blue), var(--aqua)); }
.dash-card .dash-icon.comp    { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.dash-card .dash-icon.users   { background: linear-gradient(135deg, #8e44ad, #9b59b6); }

.dash-card h6 {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
    color: var(--deep-ocean);
}

.dash-card p {
    font-size: 0.82rem;
    color: #7a8a9a;
    margin: 0;
}

/* ---------- Modal overrides ---------- */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    background: linear-gradient(135deg, var(--deep-ocean), var(--ocean-blue));
    color: white;
    border-radius: 16px 16px 0 0;
    padding: 1.2rem 1.5rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #3a4a5a;
}

.modal-body .form-control,
.modal-body .form-select {
    border-radius: 10px;
    border: 1.5px solid #dfe6ee;
    padding: 0.6rem 1rem;
    transition: var(--transition);
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: var(--light-blue);
    box-shadow: 0 0 0 3px rgba(242, 152, 45,0.12);
}

.modal-footer {
    border-top: 1px solid #eef2f7;
    padding: 1rem 1.5rem;
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #8a9aaa;
}

.empty-state .bi {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ---------- Form Check (Riega) ---------- */
.form-check-riega .form-check-input {
    width: 2.5em;
    height: 1.3em;
    cursor: pointer;
}

.form-check-riega .form-check-input:checked {
    background-color: #27ae60;
    border-color: #27ae60;
}

/* ---------- Search Section ---------- */
.search-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: #8a9aaa;
    font-size: 0.85rem;
    font-weight: 600;
}

.search-divider::before,
.search-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #dfe6ee;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .page-wrapper {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .compuerta-header {
        padding: 1.5rem;
    }
    
    .compuerta-number {
        display: none;
    }
    
    .table-hidraulica {
        font-size: 0.82rem;
    }
    
    .table-hidraulica thead th,
    .table-hidraulica tbody td {
        padding: 0.6rem 0.5rem;
    }
    
    .login-card {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f4f8;
}

::-webkit-scrollbar-thumb {
    background: var(--seafoam);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--aqua);
}

/* ---------- Animations ---------- */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
