@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #1B5E20;
    --primary-light: #2E7D32;
    --primary-dark: #0D3B12;
    --accent: #F9A825;
    --accent-light: #FFD54F;
    --gold: #D4A017;
    --bg: #F5F1EB;
    --bg-card: #FFFFFF;
    --text: #2C3E50;
    --text-light: #6B7B8D;
    --border: #E0D8CE;
    --success: #27AE60;
    --danger: #E74C3C;
    --warning: #F39C12;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============ BACKGROUND PATTERN ============ */
.bg-pattern {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #0D3B12 0%, #1B5E20 40%, #2E7D32 70%, #1B5E20 100%);
    z-index: -2;
}
.bg-pattern::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: -1;
}

/* ============ HOME PAGE ============ */
.home-container {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px; position: relative;
}
.home-card {
    background: rgba(255,255,255,0.97); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 50px 40px; max-width: 500px; width: 100%;
    text-align: center; animation: slideUp 0.6s ease-out;
    backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.3);
}
.logo-area { margin-bottom: 24px; }
.logo-area img { width: 90px; height: 90px; border-radius: 50%; border: 3px solid var(--accent); }
.logo-placeholder {
    width: 90px; height: 90px; border-radius: 50%; margin: 0 auto;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; color: white; border: 3px solid var(--accent);
    box-shadow: 0 4px 16px rgba(27,94,32,0.3);
}
.school-name {
    font-size: 14px; font-weight: 600; color: var(--primary);
    text-transform: uppercase; letter-spacing: 2px; margin-bottom: 6px;
}
.home-title {
    font-size: 26px; font-weight: 800; color: var(--primary-dark);
    margin-bottom: 8px; line-height: 1.3;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.home-subtitle { font-size: 14px; color: var(--text-light); margin-bottom: 32px; }

.code-input-group { position: relative; margin-bottom: 20px; }
.code-input {
    width: 100%; padding: 16px 20px; font-size: 24px; text-align: center;
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-family: 'Poppins', monospace; font-weight: 600; letter-spacing: 12px;
    transition: var(--transition); background: #FAFAFA; color: var(--text);
}
.code-input:focus {
    outline: none; border-color: var(--primary); background: white;
    box-shadow: 0 0 0 4px rgba(27,94,32,0.1);
}
.code-input::placeholder { letter-spacing: 4px; font-size: 16px; color: #ccc; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 32px; border: none; border-radius: var(--radius-sm);
    font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: var(--transition); text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; width: 100%; box-shadow: 0 4px 16px rgba(27,94,32,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(27,94,32,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: var(--primary-dark); box-shadow: 0 4px 16px rgba(249,168,37,0.3);
}
.btn-accent:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(249,168,37,0.4); }
.btn-sm { padding: 8px 18px; font-size: 13px; }
.btn-danger { background: linear-gradient(135deg, #c0392b, #e74c3c); color: white; }
.btn-danger:hover { transform: translateY(-2px); }
.btn-outline {
    background: transparent; border: 2px solid var(--primary); color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; display: none; font-weight: 500; }
.error-msg.show { display: block; animation: shake 0.4s ease; }

.admin-link {
    position: fixed; bottom: 20px; right: 20px;
    color: rgba(255,255,255,0.4); font-size: 12px; text-decoration: none;
    transition: var(--transition);
}
.admin-link:hover { color: rgba(255,255,255,0.8); }

/* ============ SURVEY FORM ============ */
.survey-container {
    min-height: 100vh; padding: 20px; display: flex;
    align-items: center; justify-content: center;
}
.survey-card {
    background: rgba(255,255,255,0.97); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 40px; max-width: 600px; width: 100%;
    animation: slideUp 0.5s ease-out;
}
.survey-header {
    text-align: center; margin-bottom: 30px; padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}
.survey-header h2 {
    font-size: 22px; color: var(--primary-dark); margin-bottom: 4px;
}
.survey-header p { font-size: 13px; color: var(--text-light); }

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 600; color: var(--text);
    margin-bottom: 6px;
}
.form-group label .required { color: var(--danger); }
.form-control {
    width: 100%; padding: 12px 16px; border: 2px solid var(--border);
    border-radius: var(--radius-sm); font-family: 'Poppins', sans-serif;
    font-size: 14px; transition: var(--transition); background: #FAFAFA;
}
.form-control:focus {
    outline: none; border-color: var(--primary); background: white;
    box-shadow: 0 0 0 4px rgba(27,94,32,0.1);
}
select.form-control { cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7B8D' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center;
}
.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-option {
    flex: 1; min-width: 120px; position: relative;
}
.radio-option input { display: none; }
.radio-option label {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px; border: 2px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: var(--transition); font-size: 14px; font-weight: 500;
    text-align: center;
}
.radio-option input:checked + label {
    border-color: var(--primary); background: rgba(27,94,32,0.08);
    color: var(--primary); font-weight: 600;
}
.radio-option label:hover { border-color: var(--primary-light); background: rgba(27,94,32,0.03); }

/* ============ QUESTION CARD ============ */
.question-container { position: relative; overflow: hidden; }
.question-slide {
    display: none; animation: fadeIn 0.4s ease;
}
.question-slide.active { display: block; }
.question-number {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; font-size: 14px; font-weight: 700; margin-bottom: 12px;
}
.question-text {
    font-size: 15px; line-height: 1.7; color: var(--text); margin-bottom: 24px;
    font-weight: 500;
}
.progress-bar {
    width: 100%; height: 6px; background: var(--border); border-radius: 3px;
    margin-bottom: 24px; overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: 3px; transition: width 0.4s ease;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}
.progress-text {
    font-size: 12px; color: var(--text-light); text-align: center; margin-bottom: 12px;
}

.emoji-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.emoji-option {
    position: relative;
}
.emoji-option input { display: none; }
.emoji-option label {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 18px 12px; border: 2px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: var(--transition); text-align: center;
}
.emoji-option .emoji { font-size: 36px; line-height: 1; }
.emoji-option .emoji-label { font-size: 12px; font-weight: 600; color: var(--text-light); }
.emoji-option input:checked + label {
    border-color: var(--primary); background: rgba(27,94,32,0.08);
    box-shadow: 0 4px 12px rgba(27,94,32,0.15);
    transform: scale(1.03);
}
.emoji-option input:checked + label .emoji-label { color: var(--primary); }
.emoji-option label:hover {
    border-color: var(--primary-light); transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.btn-group { display: flex; gap: 12px; justify-content: space-between; }
.btn-group .btn { flex: 1; }

/* ============ THANK YOU ============ */
.thankyou-icon { font-size: 72px; margin-bottom: 16px; animation: bounceIn 0.6s ease; }
.thankyou-title { font-size: 28px; font-weight: 800; color: var(--primary-dark); margin-bottom: 8px; }
.thankyou-text { font-size: 14px; color: var(--text-light); line-height: 1.6; }

/* ============ ADMIN ============ */
.admin-container { min-height: 100vh; }
.admin-sidebar {
    position: fixed; top: 0; left: 0; width: 260px; height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 0; z-index: 100; box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    transition: var(--transition); overflow-y: auto;
}
.sidebar-header {
    padding: 24px 20px; text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header h3 { color: white; font-size: 14px; font-weight: 600; }
.sidebar-header small { color: rgba(255,255,255,0.6); font-size: 11px; }
.sidebar-nav { padding: 16px 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px; padding: 12px 24px;
    color: rgba(255,255,255,0.75); text-decoration: none; font-size: 14px;
    font-weight: 500; transition: var(--transition); border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.1); color: white;
    border-left-color: var(--accent);
}
.sidebar-nav a .icon { font-size: 18px; width: 24px; text-align: center; }

.admin-main {
    margin-left: 260px; padding: 30px; min-height: 100vh;
    background: var(--bg);
}
.admin-topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 30px;
}
.admin-topbar h1 { font-size: 24px; color: var(--text); font-weight: 700; }
.admin-topbar .user-info {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; color: var(--text-light);
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card {
    background: white; border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow); border-left: 4px solid var(--primary);
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon { font-size: 32px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 32px; font-weight: 800; color: var(--primary-dark); }
.stat-card .stat-label { font-size: 13px; color: var(--text-light); font-weight: 500; }
.stat-card:nth-child(2) { border-left-color: var(--accent); }
.stat-card:nth-child(3) { border-left-color: var(--success); }
.stat-card:nth-child(4) { border-left-color: var(--danger); }

.card {
    background: white; border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.card-body { padding: 24px; }

.table-responsive { overflow-x: auto; }
table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
table th {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; padding: 12px 16px; text-align: left; font-weight: 600;
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
    white-space: nowrap;
}
table td {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table tr:hover td { background: rgba(27,94,32,0.03); }
.badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-warning { background: #FFF8E1; color: #F57F17; }
.badge-danger { background: #FFEBEE; color: #C62828; }

/* ============ LOGIN ============ */
.login-container {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.login-card {
    background: rgba(255,255,255,0.97); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 40px; max-width: 420px; width: 100%;
    animation: slideUp 0.5s ease-out;
}
.login-card h2 {
    text-align: center; font-size: 22px; color: var(--primary-dark); margin-bottom: 6px;
}
.login-card .login-sub {
    text-align: center; font-size: 13px; color: var(--text-light); margin-bottom: 28px;
}
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
    font-size: 13px; font-weight: 500;
}
.alert-danger { background: #FFEBEE; color: #C62828; border: 1px solid #FFCDD2; }
.alert-success { background: #E8F5E9; color: #2E7D32; border: 1px solid #C8E6C9; }

/* ============ DETAIL ============ */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px; }
.detail-item { }
.detail-item .detail-label { font-size: 11px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.detail-item .detail-value { font-size: 14px; font-weight: 500; color: var(--text); }
.answer-grid { display: grid; gap: 12px; }
.answer-item {
    display: flex; gap: 12px; padding: 14px 18px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    align-items: flex-start;
}
.answer-item .answer-num {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.answer-item .answer-content { flex: 1; }
.answer-item .answer-q { font-size: 13px; color: var(--text-light); margin-bottom: 4px; line-height: 1.5; }
.answer-item .answer-val { font-size: 14px; font-weight: 600; }
.answer-val.sangat-puas { color: #2E7D32; }
.answer-val.puas { color: #1565C0; }
.answer-val.kurang-puas { color: #F57F17; }
.answer-val.tidak-puas { color: #C62828; }

/* ============ GENERATE MODAL ============ */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: white; border-radius: var(--radius); padding: 32px;
    max-width: 440px; width: 90%; animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-lg);
}
.modal-box h3 { font-size: 18px; margin-bottom: 16px; color: var(--text); }
.generated-codes {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px;
}
.generated-code {
    padding: 8px 16px; background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; border-radius: var(--radius-sm); font-size: 18px;
    font-weight: 700; letter-spacing: 4px; font-family: monospace;
}

/* ============ ANIMATIONS ============ */
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes bounceIn { 0% { transform: scale(0.3); opacity: 0; } 50% { transform: scale(1.05); } 70% { transform: scale(0.9); } 100% { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .admin-sidebar { width: 0; overflow: hidden; }
    .admin-sidebar.open { width: 260px; }
    .admin-main { margin-left: 0; padding: 20px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .emoji-options { grid-template-columns: repeat(2, 1fr); }
    .home-card, .survey-card, .login-card { padding: 28px 20px; margin: 10px; }
    .btn-group { flex-direction: column; }
    .menu-toggle { display: block !important; }
}
.menu-toggle {
    display: none; position: fixed; top: 16px; left: 16px; z-index: 200;
    background: var(--primary); color: white; border: none; padding: 10px 14px;
    border-radius: var(--radius-sm); font-size: 20px; cursor: pointer;
}
