:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient-1: #4f46e5;
    --bg-gradient-2: #818cf8;
    --bg-gradient-3: #c026d3;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
}

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

body {
    font-family: 'Kanit', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f3f4f6;
    overflow-x: hidden;
    color: var(--text-main);
    position: relative;
}

.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--bg-gradient-1);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--bg-gradient-2);
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: var(--bg-gradient-3);
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, -30px);
    }
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    margin: 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 10;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    resize: vertical;
    min-height: 100px;
}

.input-wrapper {
    position: relative;
}

.loading-spinner {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.readonly-input {
    background-color: #f9fafb !important;
    color: #4b5563;
    cursor: default;
}

.file-upload-wrapper {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
    cursor: pointer;
}

.file-upload-wrapper:hover {
    border-color: var(--primary-color);
    background: #fdfcff;
}

.file-upload-wrapper.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.file-upload-placeholder svg {
    color: var(--primary-color);
}

.file-list {
    margin-top: 1rem;
    text-align: left;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f3f4f6;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
}

.file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.remove-file {
    color: #ef4444;
    cursor: pointer;
    font-weight: bold;
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}

.submit-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.hidden {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.visible {
    display: block;
    opacity: 1;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1f2937;
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: #10b981;
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary-color);
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

/* Large Container for Dashboard */
.container-lg {
    max-width: 900px;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: var(--radius-md);
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.history-table th,
.history-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
}

.history-table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-muted);
}

.history-table tr:hover {
    background: #fdfcff;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.cell-truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badge Styles */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #059669;
}

.badge-dcode {
    background: #e0e7ff;
    color: #4338ca;
}

/* Actions */
.table-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #fecaca;
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}