/* ============================================
   DIALYSIS MANAGEMENT SYSTEM - AdminLTE 3 Theme
   ============================================ */

/* ===== CUSTOM VARIABLES (AdminLTE 3 defaults with tweaks) ===== */
:root {
    /* AdminLTE primary blue */
    --primary: #007bff;
    --primary-dark: #0056b3;
    --primary-light: #4dabf7;
    
    /* Additional colors */
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --purple: #6f42c1;
    
    /* Dark sidebar colors */
    --dark-bg: #1a202c;
    --dark-secondary: #2d3748;
    --dark-tertiary: #4a5568;
    
    /* Light background for content */
    --light-bg: #f4f6f9;
    --light-card: #ffffff;
    --light-border: #dee2e6;
    --light-text: #495057;
    --light-muted: #6c757d;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Trebuchet MS', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--light-bg);
    color: var(--light-text);
    line-height: 1.6;
}

/* ===== ANIMATION SUPPORT (for app.js) ===== */
.card,
.small-box,
.stats-card {
    opacity: 0;
}

.animate-slideInUp {
    animation: slideInUp 0.5s ease-out forwards;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== LOGIN PAGE ===== */
.bg-light {
    background: var(--light-bg) !important;
}

.login-box {
    max-width: 400px;
    margin: 0 auto;
}

.login-card {
    background: var(--light-card);
    border-radius: 8px;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 .25rem .5rem rgba(0,0,0,.15);
    padding: 32px;
    border: 1px solid var(--light-border);
}

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

.login-logo {
    max-height: 80px;
    margin: 0 auto 16px;
    display: block;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

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

.form-group label {
    font-weight: 500;
    margin-bottom: 6px;
    color: #495057;
}

.input-group-text {
    background: #e9ecef;
    border: 1px solid #ced4da;
    color: var(--light-muted);
}

.btn-login {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #004085 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    color: white;
}

/* ===== NAVBAR ===== */
.main-header {
    background: var(--light-card) !important;
    border-bottom: 1px solid var(--light-border);
}

.main-header .nav-link {
    color: var(--light-text) !important;
    transition: color 0.2s ease;
}

.main-header .nav-link:hover {
    color: var(--primary) !important;
}

/* ===== SIDEBAR ===== */
.main-sidebar {
    background: var(--dark-bg) !important;
    border-right: 1px solid var(--dark-tertiary);
}

 .brand-link {
     background: white !important;
     border-bottom: 1px solid var(--light-border);
     padding: 12px 16px !important;
     display: flex !important;
     align-items: center !important;
     gap: 10px !important;
 }

 .brand-link .brand-text {
     color: #333 !important;
     font-weight: 600;
     font-size: 1.2rem;
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
 }

.user-panel .info a {
    color: white !important;
    font-weight: 500;
}

.user-panel .info .badge {
    background: var(--info);
    color: white;
}

/* Sidebar menu */
.sidebar .nav-sidebar .nav-link {
    color: #cbd5e0;
    border-radius: 6px;
    margin: 4px 10px;
    padding: 12px 16px;
    transition: all 0.2s ease;
}

.sidebar .nav-sidebar .nav-link:hover {
    background: var(--dark-secondary);
    color: white;
}

.sidebar .nav-sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sidebar .nav-sidebar .nav-link .nav-icon {
    margin-right: 12px;
    font-size: 1.1rem;
}

/* ===== CONTENT ===== */
.content-wrapper {
    background: var(--light-bg) !important;
    min-height: 100vh;
}

.content-header {
    background: var(--light-card) !important;
    border-bottom: 1px solid var(--light-border);
    padding: 20px 0;
}

.content-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.breadcrumb {
    background: transparent;
    padding: 0;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--light-muted);
}

/* ===== CARDS ===== */
.card {
    background: var(--light-card);
    border: 1px solid var(--light-border);
    border-radius: 8px;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 .25rem .5rem rgba(0,0,0,.15);
    margin-bottom: 24px;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 .5rem 1rem rgba(0,0,0,.15);
}

.card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    color: white;
    border-bottom: none !important;
    padding: 18px 24px;
}

.card-title {
    color: white;
    font-weight: 600;
    margin: 0;
    font-size: 1.1rem;
}

.card-body {
    padding: 24px;
}

/* ===== SMALL BOX (Dashboard Stats) ===== */
.small-box {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 .25rem .5rem rgba(0,0,0,.15);
    margin-bottom: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.small-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 .5rem 1rem rgba(0,0,0,.2);
}

.small-box .inner {
    padding: 20px;
}

.small-box h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.small-box p {
    color: rgba(255,255,255,0.9);
    margin-top: 8px;
    font-size: 0.95rem;
}

.small-box .icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 4rem;
    opacity: 0.2;
    color: white;
}

.small-box-footer {
    background: rgba(0,0,0,0.2);
    padding: 12px 20px;
    display: block;
    text-align: center;
    color: white;
    text-decoration: none;
    transition: background 0.2s ease;
}

.small-box-footer:hover {
    background: rgba(0,0,0,0.3);
    color: white;
}

.small-box.bg-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important; }
.small-box.bg-success { background: linear-gradient(135deg, var(--success) 0%, #059669 100%) !important; }
.small-box.bg-info { background: linear-gradient(135deg, var(--info) 0%, #0aa2c0 100%) !important; }
.small-box.bg-warning { background: linear-gradient(135deg, var(--warning) 0%, #e0a800 100%) !important; }
.small-box.bg-purple { background: linear-gradient(135deg, var(--purple) 0%, #59359a 100%) !important; }
.small-box.bg-danger { background: linear-gradient(135deg, var(--danger) 0%, #c82333 100%) !important; }

/* ===== TABLES ===== */
.table {
    color: var(--light-text);
    margin-bottom: 0;
}

.table thead th {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: none;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--light-border);
    vertical-align: middle;
    font-size: 0.9rem;
}

.table tbody tr {
    background: var(--light-card);
    transition: background 0.2s ease;
}

.table tbody tr:hover {
    background: rgba(0, 123, 255, 0.05);
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(0, 0, 0, 0.02);
}

.table-striped tbody tr:nth-of-type(even) {
    background: var(--light-card);
}

/* Table in cards */
.table-card {
    background: var(--light-card);
    border: 1px solid var(--light-border);
    border-radius: 8px;
    overflow: hidden;
}

.table-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
}

.table-card-header h5 {
    color: white;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-card-header .badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
}

/* ===== FORMS ===== */
.form-control {
    border: 1px solid #ced4da;
    border-radius: 6px;
    color: #495057;
    padding: 10px 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: white;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    color: #495057;
}

.form-control::placeholder {
    color: #6c757d;
}

select.form-control option {
    background: white;
    color: #495057;
    padding: 8px;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #495057;
}

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

.input-group-text {
    background: #e9ecef;
    border: 1px solid #ced4da;
    color: #6c757d;
}

/* Custom select arrow fix */
select.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23495057' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    background-color: white;
}

input[type="date"].form-control,
input[type="time"].form-control {
    color: #495057;
}

input[type="date"].form-control::-webkit-calendar-picker-indicator,
input[type="time"].form-control::-webkit-calendar-picker-indicator {
    filter: invert(0.5);
    cursor: pointer;
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::after {
    width: 300px;
    height: 300px;
}

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

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

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

.btn-success:hover {
    background: #059669;
    border-color: #059669;
    color: white;
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    border-color: #e0a800;
    color: #212529;
}

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

.btn-danger:hover {
    background: #c82333;
    border-color: #c82333;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

/* ===== ALERTS ===== */
.alert {
    border-radius: 8px;
    border: none;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.alert-success {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.15);
    color: #856404;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: rgba(23, 162, 184, 0.15);
    color: #138496;
    border-left: 4px solid var(--info);
}

/* ===== BADGES ===== */
.badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.75rem;
}

.badge-info {
    background: var(--info);
    color: white;
}

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

.badge-light {
    background: #e9ecef;
    color: #495057;
}

/* ===== FOOTER ===== */
.main-footer {
    background: var(--light-card) !important;
    border-top: 1px solid var(--light-border);
    color: var(--light-muted);
    padding: 16px 20px;
}

.main-footer a {
    color: var(--primary);
    text-decoration: none;
}

.main-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== CALLOUT (Info boxes) ===== */
.callout {
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    border-left: 4px solid;
}

.callout-info {
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.15) 0%, rgba(23, 162, 184, 0.15) 100%);
    border-left-color: var(--info);
    color: white;
}

.callout-info h5 {
    color: white;
    margin-bottom: 8px;
    font-weight: 600;
}

.callout-info p {
    margin-bottom: 0;
    color: rgba(255,255,255,0.9);
}

/* ===== PATIENT INFO BOX ===== */
.patient-info {
    background: #f8f9fa;
    border: 1px solid var(--light-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    display: none;
}

.patient-info.show {
    display: block;
}

.patient-info h5 {
    color: var(--primary);
    margin-bottom: 12px;
    font-weight: 600;
}

.patient-info p {
    color: var(--light-muted);
    margin-bottom: 4px;
}

.patient-info strong {
    color: var(--light-text);
}

/* ===== DURATION DISPLAY ===== */
.duration-display {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    border-radius: 8px;
    padding: 16px 24px;
    color: white;
    text-align: center;
    margin-top: 16px;
}

.duration-display.error {
    background: linear-gradient(135deg, var(--danger) 0%, #c82333 100%);
}

.duration-display .duration-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.duration-display .duration-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ===== FORM CARDS ===== */
.form-card {
    background: var(--light-card);
    border: 1px solid var(--light-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 .25rem .5rem rgba(0,0,0,.15);
    margin-bottom: 24px;
}

.form-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 18px 24px;
    color: white;
    border-bottom: none;
}

.form-card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.form-card-body {
    padding: 24px;
}

/* ===== RECORDS TABLE ===== */
.records-table {
    background: var(--light-card);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 1px rgba(0,0,0,.125);
}

.records-table thead th {
    background: #f8f9fa;
    color: var(--light-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--light-border);
}

.records-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--light-border);
    vertical-align: middle;
}

.records-table tbody tr:hover {
    background: #f8f9fa;
}

/* ===== SEARCH CARD ===== */
.search-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 .25rem .5rem rgba(0,0,0,.15);
    border: 1px solid var(--light-border);
}

.search-card .form-control {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: white;
    padding: 12px 16px;
    font-size: 1rem;
}

.search-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-card .form-control:focus {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
    color: white;
}

.search-card .btn {
    border-radius: 6px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-weight: 600;
}

.search-card .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* ===== STATS CARDS ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--light-card);
    border: 1px solid var(--light-border);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 .25rem .5rem rgba(0,0,0,.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 .5rem 1rem rgba(0,0,0,.15);
}

.stat-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.stat-card .icon.green {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.stat-card .icon.orange {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 800;
    color: #333;
    margin-bottom: 4px;
}

.stat-card .label {
    color: var(--light-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== DATATABLES ===== */
.dataTables_wrapper {
    padding: 0;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
    display: none;
}

.dataTables_wrapper .dataTables_info {
    padding: 16px 24px;
    color: var(--light-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--light-border);
}

.dataTables_wrapper .dataTables_paginate {
    padding: 16px 24px;
    border-top: 1px solid var(--light-border);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: #e9ecef !important;
    border: 1px solid #ced4da !important;
    color: #495047 !important;
    border-radius: 6px !important;
    margin: 0 3px;
    padding: 6px 12px;
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

/* ===== CODE / BADGES ===== */
code {
    background: #e9ecef;
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.text-muted {
    color: var(--light-muted) !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card-body {
        padding: 16px;
    }
    
    .table thead th {
        font-size: 0.75rem;
        padding: 10px 12px;
    }
    
    .table tbody td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .small-box h3 {
        font-size: 2rem;
    }
    
    .stat-card .number {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .login-card {
        padding: 24px;
        margin: 16px;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ===== UTILITY ===== */
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.d-flex { display: flex !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.text-center { text-align: center !important; }
.d-block { display: block !important; }
.pb-3 { padding-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-3 { margin-top: 1rem !important; }
