@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&family=Outfit:wght@400;600&display=swap');

:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --secondary: #a855f7;
    --accent: #10b981;
    --bg-dark: #0f172a;
    --card-glass: rgba(30, 41, 59, 0.7);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-white: #f8fafc;
    --text-muted: #94a3b8;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Sarabun', sans-serif;
}

body {
    background: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
    color: var(--text-white);
    overflow-x: hidden;
}

/* Animated background orbs */
body::before,
body::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
}

body::before {
    background: var(--primary);
    top: -100px;
    left: -100px;
    opacity: 0.2;
    animation: orbMove 20s infinite alternate;
}

body::after {
    background: var(--secondary);
    bottom: -100px;
    right: -100px;
    opacity: 0.2;
    animation: orbMove 25s infinite alternate-reverse;
}

@keyframes orbMove {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(100px, 100px);
    }
}

.container {
    width: 100%;
    max-width: 960px;
    background: var(--card-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 2rem;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.8s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    text-align: center;
    margin-bottom: 3.5rem;
}

header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    letter-spacing: 0.05rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.form-group {
    margin-bottom: 0;
}

.full-width {
    grid-column: span 2;
}

label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-white);
    font-size: 0.95rem;
    opacity: 0.9;
}

input[type="text"],
select {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-glass);
    border-radius: 0.75rem;
    padding: 0.85rem 1.25rem;
    color: white;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    outline: none;
    background: rgba(15, 23, 42, 0.8);
}

/* Score Level Legend Refined */
.score-legend {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
    margin-bottom: 3rem;
    padding: 0.5rem;
}

.legend-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 1.5rem;
    transition: var(--transition);
    height: 100%;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
}

.legend-score {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.25rem;
}

/* Individual Level Styles */
.lvl-5 .legend-score {
    background: linear-gradient(135deg, #a855f7, #6366f1);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.lvl-4 .legend-score {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.lvl-3 .legend-score {
    background: linear-gradient(135deg, #10b981, #34d399);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.lvl-2 .legend-score {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.lvl-1 .legend-score {
    background: linear-gradient(135deg, #ef4444, #f87171);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.legend-label {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-white);
    letter-spacing: 0.02rem;
}

.legend-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    max-width: 120px;
}

.assessment-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.75rem;
    margin-top: 2rem;
}

.category-header td {
    background: rgba(99, 102, 241, 0.1);
    border-radius: 0.75rem;
    padding: 1rem 1.5rem !important;
    font-weight: 600;
    color: #a5b4fc;
    font-size: 1.1rem;
    border: none !important;
}

.item-row td {
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid var(--border-glass);
    border-bottom: 1px solid var(--border-glass);
}

.item-row td:first-child {
    border-left: 1px solid var(--border-glass);
    border-radius: 1rem 0 0 1rem;
}

.item-row td:last-child {
    border-right: 1px solid var(--border-glass);
    border-radius: 0 1rem 1rem 0;
}

.score-options {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.score-option {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.score-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.score-option span {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    font-weight: 600;
}

.score-option:hover span {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.score-option input:checked+span {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    color: white;
}

.btn-submit {
    margin-top: 3rem;
    width: 100%;
    padding: 1.25rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
    transition: var(--transition);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.6);
}

.btn-submit:active {
    transform: translateY(0);
}

.ops-only {
    display: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .score-legend {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
    }

    .legend-item {
        flex-direction: row;
        text-align: left;
        padding: 1rem;
        gap: 1.25rem;
    }

    .legend-desc {
        max-width: none;
    }

    .full-width {
        grid-column: span 1;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .item-row td {
        padding: 1rem;
    }
}

/* Signature Pad */
.signature-wrapper {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-glass);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-top: 2rem;
}

.signature-pad-container {
    width: 100%;
    height: 200px;
    background: white;
    border-radius: 0.5rem;
    position: relative;
    touch-action: none;
}

#signature-pad {
    width: 100%;
    height: 100%;
    border-radius: 0.5rem;
}

.signature-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 0.75rem;
}

.btn-clear {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-clear:hover {
    color: white;
    border-color: white;
}

textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-glass);
    border-radius: 0.75rem;
    padding: 1rem;
    color: white;
    font-size: 1rem;
    min-height: 100px;
    resize: vertical;
    margin-top: 1rem;
}

/* SweetAlert Custom Styles */
.swal2-popup {
    background: var(--bg-dark) !important;
    color: white !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: 1.5rem !important;
    backdrop-filter: blur(10px);
}

.swal2-title {
    color: white !important;
}

.swal2-content {
    color: var(--text-muted) !important;
}