/* ===============================
   Root Colors
   =============================== */
:root {
    --color-primary-dark: #1e3a8a; /* Deep Blue */
    --color-primary-medium: #3b82f6; /* Medium Blue */
    --color-primary-hover: #1d4ed8; /* Darker Blue */
    --color-submit-btn: #4f46e5; /* Indigo for Submit */
    --color-submit-hover: #4338ca;
    --color-insert-btn: #10b981; /* Green for Insert */
    --color-insert-hover: #059669;
    --color-logout-btn: #ef4444; /* Red */
    --color-logout-hover: #dc2626;

    --color-success-bg: #e0f2fe;
    --color-success-text: #1d4ed8;
    --color-success-border: #60a5fa;

    --color-error-bg: #fee2e2;
    --color-error-text: #991b1b;
    --color-error-border: #f87171;
    
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 0px;
}

/* ===============================
   Base Styles
   =============================== */

.bg {
  position: relative; /* Establishes positioning context for pseudo-element */
  content: ""; /* Required for pseudo-elements to render */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height:100%;
  background-image: url('SISTEM INVENTORI ASRAMA.png');
    filter:blur(5px);
    background-position:center;
    background-repeat:no-repeat;
    background-size:cover;
  opacity: 0.2;
  z-index: -1; /* Puts the pseudo-element behind the content */
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    /* margin-left: var(--sidebar-width); */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

body.sidebar-collapsed {
    margin-left: 0;
}

header {
    background-color: var(--color-primary-dark);
    color: #fff;
    text-align: center;
    padding: 5px;
    position: relative;
    z-index: 900;
}

header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
}

/* ===============================
   Sidebar Styles
   =============================== */
.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100;
    width: 50px;
    height: 50px;
    background-color: var(--color-primary-dark);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: var(--color-primary-hover);
    transform: scale(1.05);
}

.hamburger-icon {
    display: block;
    line-height: 1;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background-color: #1e293b;
    color: white;
    transform: translateX(0);
    transition: transform 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-close {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sidebar-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.sidebar-menu {
    margin-top:20px;
    padding: 20px 0;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.sidebar-link:hover {
    background-color: rgba(59, 130, 246, 0.1);
    border-left-color: var(--color-primary-medium);
    color: white;
}

.sidebar-link.active {
    background-color: rgba(59, 130, 246, 0.15);
    border-left-color: var(--color-primary-medium);
    color: white;
    font-weight: 600;
}

.sidebar-link .text {
    flex: 1;
    font-size: 0.95rem;
}

/* Profile Section in Sidebar */
.sidebar-profile {
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.sidebar-profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
}

.sidebar-profile-link:hover {
    opacity: 0.8;
}

.sidebar-profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #fff;
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
    object-fit: cover;
}

.sidebar-profile-info {
    flex: 1;
    min-width: 0;
}

.sidebar-profile-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile-role {
    font-size: 0.8rem;
    color: #cbd5e1;
    text-transform: capitalize;
}

.sidebar-logout {
    display: block;
    margin-top: 12px;
    padding: 8px 15px;
    background-color: var(--color-logout-btn);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background-color 0.3s;
}

.sidebar-logout:hover {
    background-color: var(--color-logout-hover);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ===============================
   Navigation (Old - Completely Disabled)
   =============================== */
nav:not(.sidebar) {
    display: none !important;
}

/* ===============================
   Main Content
   =============================== */
main {
    max-width: 100%;
    min-width: 50%;
    margin: 20px auto;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    box-sizing: border-box;
}

h2 {
    color: var(--color-primary-dark);
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

/* ===============================
   Table Styling
   =============================== */
.table-container {
    overflow-x: auto;
    margin-top: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

table thead {
    background-color: var(--color-primary-dark);
    color: #fff;
}

table th, table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

table tbody tr:nth-child(even) {
    background-color: #f1f5f9;
}

table tbody tr:hover {
    background-color: #e2e8f0;
}

table th a {
    color: inherit;
    text-decoration: none;
    display: block;
    cursor: pointer;
    user-select: none;
}

table th a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.action-links a {
    display: inline-block;
    padding: 5px 10px;
    margin-right: 5px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.3s;
}

.action-links .update-btn {
    background-color: #fde047;
    color: #713f12;
}

.action-links .update-btn:hover {
    background-color: #facc15;
}

.action-links .delete-btn {
    background-color: #fca5a5;
    color: #7f1d1d;
}

.action-links .delete-btn:hover {
    background-color: #f87171;
}

.action-insert {
    margin-top: 20px;
}

.action-insert a {
    display: inline-block;
    padding: 10px 20px;
    font-weight: 700;
    color: #fff;
    background-color: var(--color-insert-btn);
    text-decoration: none;
    transition: background-color 0.3s, transform 0.1s;
}

.action-insert a:hover {
    background-color: var(--color-insert-hover);
    transform: translateY(-1px);
}

/* ===============================
   Forms
   =============================== */
form {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
}

input[type="text"], select, input[type="number"], input[type="date"], input[type="password"], input[type="file"] {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

input[type="text"]:focus, select:focus, input[type="number"]:focus, input[type="date"]:focus, input[type="password"]:focus, input[type="file"]:focus {
    border-color: var(--color-primary-medium);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

input[readonly] {
    background-color: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
}

input[type="submit"], button[type="submit"] {
    margin-top: 30px;
    padding: 12px;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    background-color: var(--color-submit-btn);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    border-radius: 8px;
}

input[type="submit"]:hover, button[type="submit"]:hover {
    background-color: var(--color-submit-hover);
    transform: translateY(-1px);
}

/* Profile Picture Upload */
.profile-picture-section {
    background-color: #f1f5f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.profile-picture-preview {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: #fff;
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 3rem;
    border: 4px solid var(--color-primary-dark);
    object-fit: cover;
}

.profile-picture-info {
    flex: 1;
}

input[type="file"] {
    padding: 10px;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    background-color: #fff;
    cursor: pointer;
}

/* ===============================
   Messages
   =============================== */
.success-message, .error-message {
    padding: 15px;
    margin: 20px 0;
    font-weight: 600;
}

.success-message {
    background-color: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid var(--color-success-border);
}

.error-message {
    background-color: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid var(--color-error-border);
}

/* ===============================
   Footer
   =============================== */
footer {
    background-color: #e2e8f0;
    color: #64748b;
    text-align: center;
    padding: 15px 0;
    font-size: 0.85rem;
    border-top: 1px solid #cbd5e1;
    margin-top: auto;
}

/* ===============================
   Header User Info (Hidden)
   =============================== */
header .logged-in {
    display: none;
}

/* ===============================
   Misc
   =============================== */
a, span {
    text-decoration: none;
}

th {
    width: auto;
}

/* ===============================
   Print Styles
   =============================== */
@media print {
    .sidebar-toggle,
    .sidebar,
    .sidebar-overlay,
    header, 
    nav, 
    footer, 
    form,
    button,
    .action-insert,
    .action-links {
        display: none !important;
    }
    
    body {
        background-color: white;
        color: black;
        padding: 0;
        margin: 0;
        margin-left: 0 !important;
    }
    
    main {
        margin: 0;
        padding: 20px;
        max-width: none;
        width: 100%;
        box-shadow: none;
    }
    
    h2 {
        color: black;
        border-bottom: 2px solid black;
        padding-bottom: 10px;
        margin-bottom: 20px;
        text-align: left;
    }
    
    .table-container {
        box-shadow: none;
        border-radius: 0;
    }
    
    table {
        page-break-inside: auto;
        width: 100%;
    }
    
    table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    table th, table td {
        border: 1px solid #333;
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    
    table th {
        background-color: #f0f0f0 !important;
        color: black !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    table tbody tr:nth-child(even) {
        background-color: #f7f7f7 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    table tbody tr:hover {
        background-color: transparent !important;
    }
}

/* ===============================
   Responsive
   =============================== */
@media (max-width: 768px) {
    body {
        margin-left: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    main {
        margin: 10px;
        padding: 15px;
    }
    
    header {
        padding: 15px;
    }
}

@media (min-width: 1200px) {
    .sidebar-close {
        display: none;
    }
}