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

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  background: #f4f7fb;
  color: #2c3e50;
}

:root {
  --primary: #0a6ed1;
  --primary-dark: #094a9a;
  --success: #28c76f;
  --warning: #ff9f43;
  --danger: #ea5455;
  --light: #ffffff;
  --shadow: 0 10px 25px rgba(0,0,0,0.08);
  --radius: 14px;
}

/* 🔐 2️⃣ LOGIN PAGE STYLE */
.login-page {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(rgba(10,110,209,0.75), rgba(10,110,209,0.75)),
              url('../hospital-bg.jpg') center/cover; /* Adjusted path */
}

.login-card {
  width: 420px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  padding: 45px 35px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  animation: fadeIn .6s ease;
}

.login-title {
  font-size: 26px;
  font-weight: 600;
  color: var(--primary-dark);
}

.login-sub {
  font-size: 13px;
  margin-bottom: 25px;
  color: #666;
}

.input-group {
  position: relative;
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  margin-bottom: 5px; /* Adjust as needed for spacing */
}

.input-group input {
  width: 100%;
  padding: 13px 40px;
  border-radius: 10px;
  border: 1px solid #ddd;
  transition: .3s;
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 5px rgba(10,110,209,.3);
}

.input-group i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #777;
}

.login-btn {
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: .3s;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(10,110,209,.4);
}

.forgot {
  display: block;
  margin-top: 14px;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
}

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

/* 🖥 3️⃣ DASHBOARD STAFF RM STYLE */
/* Layout utama */
.dashboard {
  display: flex;
  height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 25px 15px;
  flex-shrink: 0; /* Prevent sidebar from shrinking */
}

.sidebar h2 {
  font-size: 20px;
  margin-bottom: 30px;
  text-align: center;
}

.sidebar a {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  color: white;
  text-decoration: none;
  margin-bottom: 8px;
  transition: .3s;
}

.sidebar a:hover, .sidebar a.active {
  background: rgba(255,255,255,0.15);
}

/* MAIN CONTENT */
.main-content { /* Changed from .main to .main-content to avoid conflict with <main> tag */
  flex: 1;
  padding: 25px;
  overflow-y: auto;
}

/* Hamburger Menu Icon for Mobile */
.menu-toggle {
    display: none; /* Hidden by default on desktop */
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001; /* Above sidebar */
    background: var(--primary);
    color: white;
    padding: 10px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 24px;
    box-shadow: var(--shadow);
}
.menu-toggle.active {
    background: var(--danger); /* Change color when active/open */
}


/* 🔔 Dashboard Cards (Statistik) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 25px;
}

.card {
  background: var(--light);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
}

.card h3 {
  font-size: 14px;
  color: #777;
}

.card .number {
  font-size: 26px;
  font-weight: 600;
  margin-top: 8px;
}

.card.urgent { border-left: 5px solid var(--danger); }
.card.reguler { border-left: 5px solid var(--primary); }
.card.overdue { border-left: 5px solid var(--warning); }

/* 📋 Table Request RM */
.table-container {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  overflow-x: auto; /* Added for responsiveness */
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  text-align: left;
  font-size: 13px;
  color: #777;
  white-space: nowrap; /* Prevent headers from wrapping */
}

table td {
  font-size: 14px;
  white-space: nowrap; /* Prevent content from wrapping */
}

.table-container table th,
.table-container table td {
  padding: 10px 15px; /* Adjust padding for cells */
  border-right: 1px solid #eee; /* Add right border */
  border-bottom: 1px solid #eee; /* Consistent bottom border */
}

.table-container table th:last-child,
.table-container table td:last-child {
  border-right: none; /* Remove right border from last column */
}

.table-container table thead th {
  border-top: none; /* Remove top border from header */
}

.table-container table tbody tr:last-child td {
  border-bottom: none; /* Remove bottom border from last row */
}

.border-right-col {
  border-right: 1px solid #ddd; /* A subtle border */
  padding-right: 10px; /* Add some space between the content and the border */
}

.status {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  display: inline-block; /* To ensure padding works for inline elements */
}

.status.pending { background: #eef3ff; color: var(--primary); }
.status.approved { background: #e0ffe0; color: #28a745; } /* New status style */
.status.sent { background: #fff8e0; color: #ff9f43; } /* New status style */
.status.borrowed { background: #e6e6ff; color: #6666ff; } /* New status style */
.status.returned { background: #e9fff3; color: var(--success); }
.status.mutation_pending { background: #f3e5f5; color: #9c27b0; }
.status.rejected { background: #ffeaea; color: var(--danger); } /* New status style */
.status.pending_rm_approval { background: #ffe9e9; color: #ff0000; } /* Light red for pending approval */
.status.urgent { background: #ffeaea; color: var(--danger); } /* Redundant, already has generic danger */
.status.reguler { background: #eef3ff; color: var(--primary); } /* Redundant, already has generic primary */

/* 🔘 Buttons */
.btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none; /* For button-like links */
  display: inline-block; /* For button-like links */
}

.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; } /* Added for consistency */
.btn-info { background: #17a2b8; color: white; } /* New: Info button style */
.btn-secondary { background: #6c757d; color: white; } /* New: Secondary button style */
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; } /* New: Small button style */

/* Additional styles for messages */
.message {
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-weight: 500;
}
.message.success {
  background-color: #e9fff3;
  color: var(--success);
  border: 1px solid var(--success);
}
.message.error {
  background-color: #ffeaea;
  color: var(--danger);
  border: 1px solid var(--danger);
}

/* New Notification Indicator */
@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(234, 84, 85, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(234, 84, 85, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(234, 84, 85, 0);
    }
}

.new-notification-indicator {
    background-color: var(--danger);
    border-radius: 50%;
    width: 10px;
    height: 10px;
    display: inline-block;
    margin-left: 5px;
    animation: pulse-red 2s infinite;
}

/* Filter Grid for Dashboards */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

/* Filter item specific styles */
.filter-item {
  margin-bottom: 10px; /* Spacing between filter items */
}

.filter-item label {
  display: block; /* Make label take full width */
  margin-bottom: 5px; /* Space between label and input */
  font-size: 14px;
  color: #555;
  font-weight: 500;
}

/* Ensure form-control within filter-item doesn't get extra padding from other .input-group rules */
.filter-item .form-control {
  padding: 10px 15px; /* Adjust padding to be consistent and avoid icon padding */
}

/* General form control styling for consistency */
.form-control {
  width: 100%;
  padding: 13px 15px; /* Adjusted padding for inputs not inside input-group with icon */
  border-radius: 10px;
  border: 1px solid #ddd;
  transition: .3s;
  box-sizing: border-box; /* Ensure padding doesn't increase width */
  background-color: #fff; /* Ensure select has white background */
  -webkit-appearance: none; /* Remove default select arrow */
  -moz-appearance: none;
  appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-6.5%200-12.3%203.2-16.1%208.1s-1.8%2011.4%201.2%2017.4l139.8%20192c3%204.3%208.3%206.5%2013.6%206.5s10.6-2.2%2013.6-6.5l139.8-192c3-6%202.7-13.8-.4-18.1z%22%2F%3E%3C%2Fsvg%3E'); /* Custom select arrow */
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
  padding-right: 30px; /* Make space for custom arrow */
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 5px rgba(10,110,209,.3);
}

/* Adjust padding for input within input-group to prevent double padding */
.input-group .form-control {
    padding: 13px 15px; /* Override generic .input-group input padding */
}

/* Aggressive stacking for specific form fields */
.input-group.form-field-stacked {
  display: flex;
  flex-direction: column; /* Force children to stack vertically */
  align-items: flex-start; /* Align children to the start (left) */
}

/* Ensure form controls take full width within this flex container */
.input-group.form-field-stacked .form-control {
  width: 100%;
}


/* --------------------------------------------------- */
/* RESPONSIVE STYLES */
/* --------------------------------------------------- */

@media (max-width: 768px) {
    /* Login Page */
    .login-card {
        width: 90%;
        padding: 30px 20px;
    }

    /* Dashboard Layout */
    .dashboard {
        flex-direction: column;
        height: auto; /* Allow height to adjust */
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0; /* No margin from sidebar */
        padding: 15px;
        width: 100%; /* Take full width */
    }

    /* Show hamburger menu toggle */
    .menu-toggle {
        display: block;
    }

    /* Push content to the right when sidebar is open (optional, depends on desired overlay behavior) */
    body.sidebar-open .main-content {
        transform: translateX(250px);
    }

    /* Cards */
    .cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }

    .card .number {
        font-size: 22px;
    }

    /* Tables */
    /* overflow-x: auto already applied to .table-container */
    table th, table td {
        padding: 8px 5px; /* Reduce padding for smaller screens */
        font-size: 12px;
    }

    /* Filter Grid */
    .filter-grid {
        grid-template-columns: 1fr; /* Stack filters vertically */
    }

    /* Messages */
    .message {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Pagination Styles */
.pagination-wrapper {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.pagination {
    list-style: none;
    display: flex;
    gap: 8px;
    padding: 0;
}

.pagination li {
    display: inline-block;
}

.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    color: #334155;
    background: #f1f5f9;
    transition: all 0.2s ease;
}

.pagination a:hover {
    background: #2563eb;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.pagination .active a {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.pagination .dots {
    padding: 10px 6px;
    color: #94a3b8;
    font-weight: bold;
}