:root {
    /* Dark Modern Palette */
    --primary-color: #6366f1;
    /* Indigo 500 */
    --primary-hover: #818cf8;
    /* Indigo 400 */
    --background-color: #0f172a;
    /* Slate 900 */
    --card-bg: #1e293b;
    /* Slate 800 */
    --input-bg: #334155;
    /* Slate 700 */
    --text-color: #f1f5f9;
    /* Slate 100 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --border-color: #334155;
    /* Slate 700 */
    --success-color: #10b981;
    /* Emerald 500 */
    --danger-color: #ef4444;
    /* Red 500 */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(51, 65, 85, 0.95));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease-in-out;
}

header.header-hidden {
    transform: translateY(-100%);
}

.nav-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #818cf8, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.025em;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: color 0.2s;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--text-color);
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #4f46e5);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #6366f1);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #475569;
    border-color: #64748b;
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    /* Mobile fix */
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Utilities */
.text-center {
    text-align: center;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.gap-2 {
    gap: 0.5rem;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.w-full {
    width: 100%;
}

/* Survey List */
.survey-item {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    transition: transform 0.2s;
}

.survey-item:last-child {
    border-bottom: none;
}

.survey-item h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
}

.survey-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Dynamic Questions */
.question-block {
    background: rgba(15, 23, 42, 0.3);
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.option-input {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.remove-btn {
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    transition: color 0.2s;
}

.remove-btn:hover {
    color: var(--danger-color);
}

/* Mobile Responsiveness & Fixes */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    header {
        margin-bottom: 2rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .nav-links a {
        margin: 0;
        padding: 0.5rem;
    }

    .card {
        padding: 1.5rem;
    }

    /* Button stacking fix */
    .flex.items-center {
        flex-direction: column;
        /* Stack items vertically */
        align-items: stretch;
        /* Full width */
        gap: 1rem;
    }

    /* Except for specific small utility bars like question headers */
    .question-block .flex {
        flex-direction: row;
        justify-content: space-between;
    }

    /* Action buttons in survey list */
    .survey-item .flex {
        flex-direction: column;
        align-items: flex-start;
    }

    .survey-item .flex div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1rem;
    }

    .btn {
        margin: 0 !important;
        /* Override inline margins */
    }

    /* Fix weird back button: Ensure footer buttons stack properly */
    form .text-right,
    .text-right {
        text-align: center !important;
        display: flex;
        flex-direction: column-reverse;
        /* Put primary action on top usually, or just stack */
        gap: 1rem;
    }

    /* Specific fix for survey.php buttons container */
    form>div[style*="text-align: right"] {
        text-align: center !important;
        display: flex;
        flex-direction: column-reverse;
        /* "Kembali" at bottom */
        gap: 0.75rem;
    }

    /* Adjust headings */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}