/* ============================================================
   FILENAME: global.css
   DESCRIPTION: Core Variables, Reset, & Shared Utilities
   ============================================================ */

/* 1. VARIABLES (BRAND IDENTITY) */
:root {
    /* Brand Colors (Used Everywhere) */
    --primary-dark: #095c41; 
    --primary: #138963;      
    --accent: #1bb17f;       
    --white: #ffffff;
    --border-color: #e2e8f0;
    --text-dark: #0f172a;
    --text-medium: #334155;
    --text-muted: #64748b;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #f1f5f9;

    --text-main: var(--text-dark);

    /* Fonts */
    --font-main: 'Plus Jakarta Sans', sans-serif;
    
    /* Global Radius */
    --radius-pill: 100px;
    --radius-card: 16px;
    
    /* Transitions */
    --ease-smooth: cubic-bezier(0.23, 1, 0.32, 1);
}

body.dark-mode {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #1e293b;
    --bg-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --border-color: #334155;
}

/* 2. RESET & BASE */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    margin: 0; padding: 0;
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

input,
button,
select,
textarea {
    font: inherit;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0.75rem;
    z-index: 100001;
    background: var(--primary-dark);
    color: var(--white);
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-weight: 700;
}

.skip-link:focus,
.skip-link:focus-visible {
    left: 0.75rem;
}

.swal2-container {
    z-index: 20000 !important;
}

/* 3. SHARED TYPOGRAPHY */
h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
}

a { text-decoration: none; transition: 0.3s; }
ul { list-style: none; padding: 0; margin: 0; }

/* 4. UTILITIES */
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.fw-bold { font-weight: 700 !important; }
.fw-extra-bold { font-weight: 800 !important; }
.bg-card { background-color: var(--bg-card) !important; }
.bg-input { background-color: var(--bg-input) !important; }
.text-body-adaptive { color: var(--text-main) !important; }
.text-muted-adaptive { color: var(--text-muted) !important; }
.border-adaptive { border-color: var(--border-color) !important; }

body.dark-mode .text-muted,
body.dark-mode .text-secondary,
body.dark-mode .small.text-muted {
    color: var(--text-muted) !important;
}

body.dark-mode .text-dark,
body.dark-mode .text-body,
body.dark-mode .text-body-emphasis {
    color: var(--text-main) !important;
}

body.dark-mode .bg-white,
body.dark-mode .bg-light {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
}

body.dark-mode .border,
body.dark-mode .border-top,
body.dark-mode .border-bottom,
body.dark-mode .border-start,
body.dark-mode .border-end,
body.dark-mode .border-secondary-subtle,
body.dark-mode .border-light {
    border-color: var(--border-color) !important;
}

body.dark-mode .btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border-color);
    background: transparent;
}

body.dark-mode .btn-outline-secondary:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

body.dark-mode .table,
body.dark-mode .table td,
body.dark-mode .table th {
    color: var(--text-main);
    border-color: var(--border-color);
}

body.dark-mode .modal-content,
body.dark-mode .dropdown-menu {
    background-color: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-color);
}

/* Tombol Standar */
.btn {
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    vertical-align: middle;
    line-height: 1.1;
}

.btn .badge {
    top: 0;
}

input,
select,
textarea,
.form-control,
.form-select {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 10px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--primary, #138963);
    box-shadow: 0 0 0 3px rgba(19, 137, 99, 0.18);
    outline: none;
}

.card:not(.reset-card) {
    border: 1px solid var(--border-color, #e2e8f0);
}

@media (pointer: coarse) {
    .btn,
    button,
    [role="button"],
    input,
    select {
        min-height: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}