@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #0f766e;
    --primary-strong: #0b5d57;
    --accent-color: #f59e0b;
    --secondary-color: #4b5563;
    --bg-light: #f5f7fb;
    --bg-dark: #0f172a;
    --text-light: #1f2937;
    --text-dark: #e5e7eb;
    --card-bg-light: rgba(255, 255, 255, 0.9);
    --card-bg-dark: rgba(30, 41, 59, 0.9);
    --border-color: #e5e7eb;
    --shadow-soft: 0 10px 30px rgba(15, 118, 110, 0.12);
    --radius: 14px;
    --transition: 0.25s ease;
    --font-size-base: 14px;
    --line-height-base: 1.6;
}

[data-bs-theme="dark"] {
    --bg-light: var(--bg-dark);
    --text-light: var(--text-dark);
    --card-bg-light: var(--card-bg-dark);
}

* {
    scroll-behavior: smooth;
}

body {
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    min-height: 100vh;
    color: var(--text-light);
    transition: background-color var(--transition), color var(--transition);
    position: relative;
    background: linear-gradient(135deg, #f9fafb 0%, #eef2ff 100%);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(15, 118, 110, 0.08), transparent 35%),
                radial-gradient(circle at 80% 0%, rgba(245, 158, 11, 0.08), transparent 30%),
                linear-gradient(135deg, rgba(15, 23, 42, 0.07), rgba(15, 118, 110, 0.04));
    z-index: -2;
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.55);
    z-index: -1;
    transition: background-color var(--transition);
}

[data-bs-theme="dark"] .bg-overlay {
    background: rgba(0, 0, 0, 0.35);
}

/* Global Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 1050;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    padding: 12px 18px;
}

.app-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(245, 158, 11, 0.16) 0%, rgba(15, 118, 110, 0.18) 40%, rgba(15, 118, 110, 0.08) 100%);
    pointer-events: none;
    z-index: -1;
}

[data-bs-theme="dark"] .app-header {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.app-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 6px;
}

.app-brand {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-strong);
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.app-title {
    display: inline-block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: -0.1px;
    padding: 4px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.app-subtitle {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.9rem;
    color: #374151;
    padding: 3px 9px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

[data-bs-theme="dark"] .app-title,
[data-bs-theme="dark"] .app-subtitle {
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-dark);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header-user-link {
    text-decoration: none;
    color: inherit;
}

.app-header-user-link:hover .app-header-user {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
}

.app-header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    transition: all var(--transition);
}

.app-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1.1rem;
}

.app-header-avatar.placeholder {
    width: 44px;
    height: 44px;
}

.app-header-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.app-header-user-name {
    font-weight: 700;
    color: var(--text-light);
}

.app-header-user-role {
    font-size: 0.85rem;
    color: #6b7280;
}

.kode-unik {
    color: transparent;
    position: relative;
    cursor: pointer;
}

.kode-unik::after {
    content: attr(data-mask);
    color: #9ca3af;
}

.kode-unik:hover {
    color: var(--text-light);
}

.kode-unik:hover::after {
    content: '';
}

[data-bs-theme="dark"] .app-header-user {
    background: rgba(15, 23, 42, 0.88);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

/* Bootstrap Overrides */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-strong));
    border-color: var(--primary-strong);
    transition: all var(--transition);
    box-shadow: var(--shadow-soft);
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.1px;
    font-size: 0.95rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-strong), var(--primary-color));
    border-color: var(--primary-strong);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 118, 110, 0.18);
}

.btn {
    transition: all var(--transition);
    border-radius: 10px;
}

.btn:hover {
    transform: translateY(-1px);
}

.card {
    background-color: var(--card-bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.07);
    backdrop-filter: blur(10px);
    transition: all var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
}

.form-control {
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    transition: all var(--transition);
    background: #fff;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.15);
    background: #fff;
}

.input-group-text {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px 0 0 10px;
    font-weight: 600;
}

/* Loading Spinner */
.spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Dark Mode Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--card-bg-light);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Custom Table Styles */
.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--border-color);
}

.table thead th {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-strong));
    border-bottom: 1px solid transparent;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.2px;
}

.table tbody tr {
    transition: background-color var(--transition);
    border-bottom: 1px solid #edf1f5;
}

.table tbody tr:hover {
    background-color: rgba(15, 118, 110, 0.05);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table td {
    vertical-align: middle;
    padding: 10px 14px;
    border: none;
}

/* Kode Unik Hover Reveal */
.kode-unik-mask {
    display: inline;
    letter-spacing: 0.08rem;
    color: #9ca3af;
}

.kode-unik-real {
    display: none;
    font-weight: 600;
    color: var(--text-light);
}

table tbody tr:hover .kode-unik-mask { display: none; }
table tbody tr:hover .kode-unik-real { display: inline; }

.text-primary {
    color: #333 !important;
}

.text-secondary {
    color: #666 !important;
}

.table-dark th {
    background-color: #f0f0f0;
    color: #333;
    border-color: #ddd;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05);
}

h1, .h1 { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.4px; }
h2, .h2 { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.3px; }
h3, .h3 { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.2px; }
h4, .h4 { font-size: 1.15rem; font-weight: 600; }
h5, .h5 { font-size: 1.05rem; font-weight: 600; }
h6, .h6 { font-size: 0.95rem; font-weight: 600; }

.card-title { margin-bottom: 0.35rem; }
.card-subtitle { color: #6b7280; font-size: 0.9rem; }

.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #fef3c7;
    color: #92400e;
}

/* Enhanced Table Styles */
.table {
    background-color: var(--card-bg-light);
}

/* Enhanced Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Tooltip Enhancement */
.tooltip-inner {
    background-color: var(--primary-color);
    font-size: 0.875rem;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: var(--primary-color);
}

/* Alert Enhancements */
.alert {
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

/* Modal Enhancements */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    border-radius: 15px 15px 0 0;
}

/* Progress Bar */
.progress {
    height: 8px;
    border-radius: 4px;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), #e55a00);
    transition: width 0.3s ease;
}

/* Pagination Styles */
.pagination {
    margin-bottom: 0;
}

.page-link {
    color: var(--primary-strong);
    border-color: #e5e7eb;
    transition: all var(--transition);
    border-radius: 10px;
}

.page-link:hover {
    color: var(--primary-color);
    background-color: rgba(15, 118, 110, 0.08);
    border-color: var(--primary-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-strong);
}

.page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
    border-color: #dee2e6;
}

/* Clean Data Button */
#cleanDataBtn {
    border: 1.5px solid #dc2626;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: all var(--transition);
    border-radius: 10px;
}

#cleanDataBtn:hover {
    background-color: #b91c1c;
    border-color: #991b1b;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(220, 38, 38, 0.22);
}

#cleanDataBtn:active {
    transform: translateY(0);
}

/* Menu Cards */
.menu-card {
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--card-bg-light);
    border-radius: 20px !important;
    overflow: hidden;
    position: relative;
}

.menu-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #e55a00);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.menu-card:hover::before {
    transform: scaleX(1);
}

.menu-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.menu-icon {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.menu-card .btn {
    border-radius: 25px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.menu-card .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.8s ease-out;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 1; transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.bounce-in {
    animation: bounceIn 0.8s ease-out;
}

.global-footer {
    font-size: 0.9rem;
    color: #6b7280;
    padding: 16px 12px 20px;
}

/* Add User Form Styles */
.add-user-form .card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-strong));
    border-bottom: none;
}

.add-user-form .form-label {
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.add-user-form .form-control,
.add-user-form .form-select {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.add-user-form .form-control:focus,
.add-user-form .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.25);
}

.add-user-form .btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-strong));
    border: none;
    border-radius: 8px;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: transform var(--transition);
}

.add-user-form .btn-primary:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--primary-strong), #0b5d57);
}

/* Search Area Styles */
.user-search-area {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.05), rgba(15, 118, 110, 0.02));
    border-bottom: 1px solid rgba(15, 118, 110, 0.1);
}

.user-search-area .form-label {
    color: var(--primary-color);
    font-weight: 600;
}

.user-search-area .form-control {
    border: 1px solid rgba(15, 118, 110, 0.2);
    border-radius: 6px;
}

.user-search-area .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.15);
}

.user-search-area .btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all var(--transition);
}

.user-search-area .btn:hover {
    transform: translateY(-1px);
}

.user-search-area .btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-strong));
    border: none;
}

.user-search-area .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-strong), #0b5d57);
    box-shadow: 0 4px 8px rgba(15, 118, 110, 0.3);
}

.user-search-area .btn-outline-secondary {
    border-color: rgba(15, 118, 110, 0.3);
    color: var(--primary-color);
}

.user-search-area .btn-outline-secondary:hover {
    background-color: rgba(15, 118, 110, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-strong);
}

/* Custom Gradient Backgrounds for Card Headers */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-strong));
    border-bottom: none;
    position: relative;
}

.bg-gradient-primary::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), transparent);
    border-radius: 0 0 var(--radius) var(--radius);
}

.bg-gradient-accent {
    background: linear-gradient(135deg, var(--accent-color), #d97706);
    border-bottom: none;
    position: relative;
}

.bg-gradient-accent::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), transparent);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Enhanced card styling */
.card-header.bg-gradient-primary,
.card-header.bg-gradient-accent {
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-header.bg-gradient-primary h5,
.card-header.bg-gradient-accent h5 {
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}