/* ERESYS Premium Glassmorphic Styling System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-dark: #faf8f2;
    --bg-panel: rgba(255, 255, 255, 0.95);
    --border-color: rgba(153, 51, 204, 0.12);
    --text-primary: #2d264d;
    --text-secondary: #5c4e8c;
    --text-muted: #8e7fb0;
    
    /* Repeating SVG pattern (Paw + Heart in brand colors) */
    --bg-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M15 25c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3-5c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm6 0c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3 5c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm-5 4c-2.2 0-4-1.8-4-4 0-1.5 1.5-3 4-3s4 1.5 4 3c0 2.2-1.8 4-4 4z' fill='%239933cc' fill-opacity='0.03'/%3E%3Cpath d='M55 52c-2-2-5-2-7 0-2-2-5-2-7 0-1 1-1 3 0 4l7 7 7-7c1-1 1-3 0-4z' fill='%23d97706' fill-opacity='0.035'/%3E%3C/svg%3E");
    
    /* Role Colors */
    --color-admin: #9933cc;       /* Purple (Ambulance Primary) */
    --color-lab: #d97706;         /* Gold (Ambulance Secondary) */
    --color-apotik: #10b981;      /* Emerald */
    --color-kolega: #ec4899;      /* Pink */
    
    /* Active color placeholder */
    --accent-color: #9933cc;      /* Main Purple */
    --accent-glow: rgba(153, 51, 204, 0.08);
}

/* Base resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: var(--bg-pattern);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Sidebar Layout */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.logo-section h1 {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #9933cc, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.logo-section .badge {
    background: rgba(153, 51, 204, 0.08);
    color: #9933cc;
    border: 1px solid rgba(153, 51, 204, 0.15);
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 600;
}

.menu-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.menu-item a:hover {
    background: rgba(153, 51, 204, 0.04);
    color: var(--accent-color);
}

.menu-item.active a {
    background: var(--accent-glow);
    color: var(--accent-color);
    border-color: rgba(153, 51, 204, 0.15);
    box-shadow: 0 4px 12px rgba(153, 51, 204, 0.04);
    position: relative;
}

.menu-item.active a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 4px;
    background: var(--accent-color);
    border-radius: 0 4px 4px 0;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #f43f5e;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(244, 63, 94, 0.08);
}

/* Main Area Layout */
.main-wrapper {
    flex-grow: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-navbar {
    height: 80px;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-title h2 {
    font-size: 20px;
    font-weight: 600;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Tester Role Switcher */
.role-switcher-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-switcher-container label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-select {
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border 0.3s ease;
}

.role-select:focus {
    border-color: var(--accent-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-color), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
}

.profile-role {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Content Area */
.content-body {
    padding: 40px;
    flex-grow: 1;
}

/* Cards & Widgets */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.12);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
}

/* Panels / Modules */
.card {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    margin-top: 12px;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-custom th {
    padding: 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.table-custom td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table-custom tr {
    transition: background 0.3s ease;
}

.table-custom tr:hover td {
    background: rgba(153, 51, 204, 0.02);
    color: var(--text-primary);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(153, 51, 204, 0.1);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 14px rgba(153, 51, 204, 0.25);
}

.btn-primary:hover {
    background: #8222b5;
    box-shadow: 0 6px 20px rgba(153, 51, 204, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
    background: #f43f5e;
    color: white;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    background: #e11d48;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 8px;
}

/* Badges / Labels */
.badge-status {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-status.acc {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-status.selesai {
    background: rgba(153, 51, 204, 0.1);
    color: #9933cc;
    border: 1px solid rgba(153, 51, 204, 0.2);
}

/* Login Page Styling */
.login-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-dark);
    background-image: var(--bg-pattern);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-panel);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(153, 51, 204, 0.06);
    text-align: center;
}

.login-header {
    margin-bottom: 32px;
}

.login-header h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #9933cc, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-danger {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.close-btn {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    font-weight: 700;
}

/* Modal and Overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Image preview section */
.image-upload-wrapper {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.image-preview-slot {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.01);
}

.image-preview-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Footer layout */
.footer-text {
    text-align: center;
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Demo Credentials Table on Login Screen */
.demo-creds {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: left;
}

.demo-creds h4 {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.demo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 11px;
}

.demo-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
}

.demo-box strong {
    color: var(--text-primary);
}

.demo-box span {
    color: var(--text-secondary);
}

/* Dashboard dynamic role coloring classes */
body.role-1 { --accent-color: var(--color-admin); --accent-glow: rgba(168, 85, 247, 0.15); }
body.role-2 { --accent-color: var(--color-lab); --accent-glow: rgba(6, 182, 212, 0.15); }
body.role-3 { --accent-color: var(--color-apotik); --accent-glow: rgba(16, 185, 129, 0.15); }
body.role-4 { --accent-color: var(--color-kolega); --accent-glow: rgba(245, 158, 11, 0.15); }
