/* Neumorphism Component Styles */

/* Neumorphism Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Kanit', sans-serif;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    background: var(--neu-bg);
    color: var(--light-text);
    box-shadow: var(--shadow-neu-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 3px 3px 8px rgba(163, 177, 198, 0.5), -3px -3px 8px rgba(255, 255, 255, 0.8);
}

.btn:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-neu-pressed);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow:
        4px 4px 10px rgba(44, 119, 68, 0.4),
        -4px -4px 10px rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 3px 3px 10px rgba(44, 119, 68, 0.4), -3px -3px 10px rgba(255, 255, 255, 0.3);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
    box-shadow:
        4px 4px 10px rgba(16, 185, 129, 0.4),
        -4px -4px 10px rgba(255, 255, 255, 0.3);
}

.btn-success:hover {
    box-shadow: 3px 3px 10px rgba(16, 185, 129, 0.4), -3px -3px 10px rgba(255, 255, 255, 0.3);
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
    box-shadow:
        4px 4px 10px rgba(239, 68, 68, 0.4),
        -4px -4px 10px rgba(255, 255, 255, 0.3);
}

.btn-danger:hover {
    box-shadow: 3px 3px 10px rgba(239, 68, 68, 0.4), -3px -3px 10px rgba(255, 255, 255, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    box-shadow:
        4px 4px 10px rgba(245, 158, 11, 0.4),
        -4px -4px 10px rgba(255, 255, 255, 0.3);
}

.btn-secondary {
    background: var(--gradient-secondary);
    color: var(--light-text);
    box-shadow:
        4px 4px 10px rgba(249, 224, 118, 0.4),
        -4px -4px 10px rgba(255, 255, 255, 0.5);
}

.btn-secondary:hover {
    box-shadow: 3px 3px 10px rgba(249, 224, 118, 0.4), -3px -3px 10px rgba(255, 255, 255, 0.5);
}

.btn-sm {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

/* Neumorphism Form Controls */
.form-group {
    margin-bottom: var(--spacing-lg);
    position: relative;
}

.form-row {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.form-row>.form-group {
    flex: 1;
    margin-bottom: 0;
    min-width: 250px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.form-grid>.form-group {
    margin-bottom: 0;
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-3 {
    grid-column: span 3;
}


.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    color: var(--light-text);
    font-size: 0.95rem;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-left: 3rem;
    font-size: 1rem;
    font-family: 'Kanit', sans-serif;
    background: var(--neu-bg);
    border: none;
    border-radius: var(--radius-md);
    color: var(--light-text);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-neu-inset);
}

.form-control:focus {
    outline: none;
    box-shadow:
        inset 4px 4px 8px rgba(44, 119, 68, 0.15),
        inset -4px -4px 8px rgba(255, 255, 255, 0.9),
        0 0 0 3px rgba(44, 119, 68, 0.1);
}

.form-control::placeholder {
    color: var(--gray-text);
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-text);
    font-size: 1.2rem;
    transition: color var(--transition-base);
    pointer-events: none;
    z-index: 1;
}

.form-group:focus-within .input-icon {
    color: var(--primary-color);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    padding-left: 1rem;
}

select.form-control {
    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='%236c757d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
    cursor: pointer;
}

/* Neumorphism Checkbox Styles */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.checkbox-item {
    position: relative;
}

.checkbox-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    background: var(--neu-bg);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    user-select: none;
    box-shadow: var(--shadow-neu-sm);
}

.checkbox-label::before {
    content: '';
    width: 22px;
    height: 22px;
    margin-right: var(--spacing-sm);
    border: none;
    border-radius: 8px;
    transition: all var(--transition-base);
    flex-shrink: 0;
    box-shadow:
        inset 2px 2px 4px rgba(163, 177, 198, 0.5),
        inset -2px -2px 4px rgba(255, 255, 255, 0.7);
}

.checkbox-item input[type="checkbox"]:checked+.checkbox-label {
    box-shadow: var(--shadow-neu-pressed);
}

.checkbox-item input[type="checkbox"]:checked+.checkbox-label::before {
    background: var(--primary-color);
    box-shadow:
        2px 2px 4px rgba(44, 119, 68, 0.3),
        -2px -2px 4px rgba(255, 255, 255, 0.3);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 75%;
    background-position: center;
    background-repeat: no-repeat;
}

.checkbox-label:hover {
    box-shadow:
        5px 5px 10px rgba(163, 177, 198, 0.6),
        -5px -5px 10px #ffffff;
}

/* Neumorphism Modal - GPU Optimized */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(224, 229, 236, 0.97);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--neu-bg);
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-neu);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 2px solid rgba(163, 177, 198, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: var(--neu-bg);
    border: none;
    color: var(--gray-text);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: var(--shadow-neu-sm);
}

.modal-close:hover {
    color: var(--danger-color);
    box-shadow: var(--shadow-neu-pressed);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    padding: var(--spacing-lg);
    border-top: 2px solid rgba(163, 177, 198, 0.2);
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

/* Neumorphism Loading Spinner - GPU Optimized */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(224, 229, 236, 0.97);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--neu-bg);
    box-shadow: var(--shadow-neu);
    position: relative;
}

.spinner::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Neumorphism Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    white-space: nowrap;
    box-shadow: 2px 2px 4px rgba(163, 177, 198, 0.4), -2px -2px 4px #ffffff;
}

.badge-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.3) 100%);
    color: #047857;
}

.badge-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.3) 100%);
    color: #dc2626;
}

.badge-warning {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0.3) 100%);
    color: #d97706;
}

.badge-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.3) 100%);
    color: #2563eb;
}

/* Neumorphism Table */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: var(--neu-bg);
    box-shadow: var(--shadow-neu);
    padding: var(--spacing-md);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead {
    background: transparent;
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--primary-dark);
    border-bottom: 2px solid rgba(44, 119, 68, 0.15);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(163, 177, 198, 0.2);
}

.table tbody tr {
    transition: all var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Neumorphism Alert */
.alert {
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: var(--shadow-neu-sm);
    border: none;
}

.alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.15) 100%);
    color: #1d4ed8;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.15) 100%);
    color: #b45309;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.15) 100%);
    color: #b91c1c;
}

/* PDPA Notice - Neumorphism */
.pdpa-notice {
    background: var(--neu-bg);
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow:
        inset 3px 3px 6px rgba(163, 177, 198, 0.4),
        inset -3px -3px 6px rgba(255, 255, 255, 0.6);
}

.pdpa-notice h4 {
    color: #b45309;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.pdpa-notice p {
    color: var(--gray-text);
    margin-bottom: var(--spacing-md);
}

.pdpa-notice a {
    color: var(--primary-color);
    text-decoration: underline;
}

.pdpa-notice a:hover {
    color: var(--primary-dark);
}

/* Responsive */
@media (max-width: 768px) {
    .checkbox-group {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: var(--radius-md);
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .table-responsive {
        font-size: 0.875rem;
        padding: var(--spacing-sm);
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
}