/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #4361ee;
    --primary-light: #4895ef;
    --secondary-color: #3f37c9;
    --success-color: #2ec4b6;
    --warning-color: #ff9f1c;
    --danger-color: #e63946;
    --light-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #2b2d42;
    --text-muted: #8d99ae;
    --border-radius: 12px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.05);
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f0f2f5;
    color: var(--text-color);
}

/* Layout */
.sidebar {
    height: 100vh;
    width: 250px;
    position: fixed;
    top: 0;
    left: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: var(--shadow-md);
    border-right: none;
    padding-top: 20px;
    padding-bottom: 80px; /* Ensure bottom items are clickable */
    z-index: 1000;
    overflow-y: auto;
    /* Hide scrollbar for Chrome, Safari and Opera */
    &::-webkit-scrollbar {
        display: none;
    }
    /* Hide scrollbar for IE, Edge and Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.main-content {
    margin-left: 250px;
    padding: 30px;
    min-height: 100vh;
}

/* Sidebar Elements */
.sidebar h4 {
    color: white;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 20px 0;
}

.sidebar a {
    color: rgba(255,255,255,0.8) !important;
    border-radius: 8px;
    margin: 8px 15px;
    padding: 12px 15px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
}

.sidebar a:hover, .sidebar a.active {
    background-color: rgba(255,255,255,0.2) !important;
    color: white !important;
    transform: translateX(5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.sidebar hr {
    background-color: rgba(255,255,255,0.3) !important;
    opacity: 0.5;
}

/* Navbar */
.navbar {
    background-color: white !important;
    box-shadow: var(--shadow-sm);
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 30px;
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary-color) !important;
    font-size: 1.25rem;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    background: white;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 20px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-weight: 600;
    padding: 15px 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

.card-stat {
    color: white !important;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.card-stat::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 150px;
    height: 150px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    z-index: -1;
}

.card-stat::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    z-index: -1;
}

/* Stats Colors */
.bg-primary { background: linear-gradient(135deg, #4361ee, #3f37c9) !important; }
.bg-success { background: linear-gradient(135deg, #2ec4b6, #20a094) !important; }
.bg-info { background: linear-gradient(135deg, #4cc9f0, #4895ef) !important; }

/* Buttons */
.btn {
    border-radius: 10px;
    padding: 10px 24px;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(67, 97, 238, 0.25);
}

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

/* Inputs */
.form-control, .form-select {
    border-radius: 10px;
    border: 1px solid #e9ecef;
    padding: 12px 15px;
    background-color: #f8f9fa;
    transition: all 0.3s;
}

.form-control:focus, .form-select:focus {
    background-color: white;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
    border-color: var(--primary-color);
}

/* Tables */
.table thead th {
    background-color: #f8f9fa;
    color: var(--text-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
    padding: 15px;
}

.table tbody td {
    padding: 15px;
    vertical-align: middle;
    color: var(--text-color);
}

/* Login Page Only */
.login-body {
    background-color: #ffffff;
    height: 100vh;
    overflow: hidden;
    font-family: 'Poppins', sans-serif;
}

.login-container {
    height: 100vh;
}

/* Brand Section (Left) */
.login-brand-section {
    background: linear-gradient(135deg, #1A2980 0%, #26D0CE 100%); /* Deeper, richer gradient */
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.brand-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.5;
}

.brand-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    z-index: 0;
}

.login-icon-large {
    width: 100px; /* Slightly smaller for balance */
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px; /* Soft square */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.tracking-wide {
    letter-spacing: 2px;
}

.brand-divider {
    width: 40px;
    height: 4px;
    background: #26D0CE;
    border-radius: 2px;
}

/* Quote Box */
.quote-box {
    position: relative;
    padding: 1rem;
}
.quote-line {
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    margin: 10px auto 0;
}

/* Pulse Animation Circles */
.pulse-circle {
    position: absolute;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    z-index: -1;
    animation: pulse 8s infinite ease-in-out;
}
.c1 { width: 600px; height: 600px; top: -100px; right: -200px; animation-delay: 0s; }
.c2 { width: 500px; height: 500px; bottom: -100px; left: -100px; animation-delay: 2s; }
.c3 { width: 300px; height: 300px; top: 40%; left: 40%; animation-delay: 4s; }

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.5; }
}

.floating-icon {
    animation: floating 4s ease-in-out infinite;
}
@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* Login Form Section (Right) */
.login-form-section {
    background-color: #ffffff;
}

/* Floating Labels & Outlined Inputs */
.form-floating > .form-control {
    border: 2px solid #f0f2f5;
    border-radius: 12px;
    background-color: #ffffff;
    padding-left: 1rem;
    height: 52px;
    font-size: 0.95rem;
}

.form-floating > label {
    padding-left: 1rem;
    padding-top: 0.75rem;
    font-size: 0.9rem;
}

.form-floating > .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

.form-floating > .form-control:focus ~ label {
    color: var(--primary-color);
    font-weight: 500;
}

.btn-login {
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    transition: all 0.3s;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(67, 97, 238, 0.3);
}

/* Checkbox */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Profile Link Header */
.profile-link {
    transition: all 0.2s ease;
    padding: 5px 10px;
    border-radius: 50px;
}
.profile-link:hover {
    background-color: rgba(0,0,0,0.03);
    transform: translateY(1px);
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 100vh;
        transform: translateY(-100%) !important;
        transition: transform 0.3s ease-in-out;
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
    }
    
    .sidebar.show {
        transform: translateY(0) !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px; /* Reduced padding for mobile */
        transition: margin 0.3s ease-in-out;
    }
    
    /* Overlay when sidebar is open */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 900;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }
}

/* Extra Small Devices (Phones) */
@media (max-width: 767.98px) {
    body {
        font-size: 14px; /* Slightly smaller base font */
    }

    h3 { font-size: 1.5rem; }
    h2 { font-size: 1.75rem; }

    /* Compact Cards */
    .card {
        margin-bottom: 15px;
        border-radius: 12px; /* Slightly smaller radius */
    }

    .card-header {
        padding: 12px 15px;
    }

    .card-body {
        padding: 15px;
    }

    /* Compact Tables */
    .table thead th {
        font-size: 0.75rem;
        padding: 10px 8px; /* Tighter padding */
    }

    .table tbody td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    /* Buttons */
    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 10px 20px;
        font-size: 1rem;
    }

    /* Navbar Brand */
    .navbar-brand {
        font-size: 1.1rem;
        max-width: 200px;
    }

    /* Form Inputs */
    .form-control, .form-select {
        height: 42px; /* Ensure 42px height for easy tapping */
        font-size: 16px; /* Prevent iOS zoom */
    }

    /* Adjust Select2 to match */
    .select2-container .select2-selection--single {
        height: 42px !important;
    }
    
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 42px !important;
        font-size: 16px;
    }
}

/* Print Styling */
@media print {
    /* Hide EVERYTHING by default */
    body * {
        visibility: hidden;
    }

    /* Only show the card and its content */
    #kartu-pasien, #kartu-pasien * {
        visibility: visible;
    }

    /* Position the card centered on the page */
    #kartu-pasien {
        position: absolute;
        left: 50%;
        top: 20%;
        transform: translate(-50%, 0);
        width: 100%;
        max-width: 400px; /* Standard card width */
        border: 2px solid #000 !important; /* Defined border */
        padding: 20px !important;
        box-shadow: none !important;
        background-color: white !important;
    }

    /* Hide the print button inside the card */
    #kartu-pasien .btn {
        display: none !important;
    }

    /* Ensure text is black */
    #kartu-pasien h5, #kartu-pasien h4, #kartu-pasien p {
        color: black !important;
    }
}
