:root {
    --bg-dark: #0f172a;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --surface: rgba(30, 41, 59, 0.7);
    --surface-border: rgba(255, 255, 255, 0.1);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --success: #10b981;
}

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

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

#bg-anim {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
                radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.15), transparent 25%);
    filter: blur(60px);
    animation: drift 20s infinite alternate linear;
}

@keyframes drift {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.1) translate(5%, 5%); }
}

.glass-container {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.center-box {
    width: 100%;
    max-width: 400px;
    margin: 10vh auto;
    padding: 2.5rem;
    display: none;
    flex-direction: column;
    gap: 1.5rem;
}

.center-box.active {
    display: flex;
    animation: fadeUp 0.4s ease-out forwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.center-box h2 {
    font-size: 1.75rem;
    font-weight: 600;
}
.center-box p {
    color: var(--text-muted);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

input[type="text"], input[type="password"], input[type="datetime-local"], select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s;
}

textarea {
    min-height: 80px;
    resize: vertical;
    line-height: 1.5;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

button:hover {
    background: var(--primary-hover);
}
button:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.error-msg {
    color: var(--danger);
    font-size: 0.875rem;
    min-height: 20px;
}

/* Dashboard */
.dashboard-container {
    display: none;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}
.dashboard-container.active {
    display: block;
    animation: fadeUp 0.4s ease-out forwards;
}

.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem 2rem;
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.client-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.2s, border-color 0.2s;
}
.client-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.2);
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.client-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge.active { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge.suspended { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge.maintenance { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }

.client-details {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.client-details span {
    color: var(--text);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    max-height: 90vh;
    overflow-y: auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
}

.form-grid .input-group.full-width {
    grid-column: 1 / -1;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}
.checkbox-group input {
    width: auto;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

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

.btn-danger:disabled {
    background: rgba(239, 68, 68, 0.3);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-danger.ready {
    background: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
    animation: pulseDanger 1.5s infinite alternate;
}

@keyframes pulseDanger {
    0% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
    100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.8); }
}

.btn-icon {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--surface-border);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

.card-actions {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    gap: 0.75rem;
}

.card-actions button {
    flex: 1;
}

/* Delete Modal Styling */
.modal-delete {
    max-width: 480px;
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.15);
}

.delete-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.warning-badge {
    align-self: flex-start;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.delete-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.delete-description strong {
    color: var(--text);
}

.delete-description code {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    color: #f43f5e;
}

.code-verification-box {
    background: rgba(15, 23, 42, 0.8);
    border: 1px dashed rgba(239, 68, 68, 0.4);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.code-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.code-badge-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.code-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: #f43f5e;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(244, 63, 94, 0.3);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    flex: 1;
    text-align: center;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.no-paste-input {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    letter-spacing: 0.1em;
    border-color: rgba(239, 68, 68, 0.3);
}

.no-paste-input:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.paste-warning-text {
    color: #f43f5e;
    font-size: 0.8rem;
    margin-top: 0.4rem;
    font-weight: 500;
    animation: fadeIn 0.2s ease-in;
}

/* Modal Form Enhancements */
.modal-header {
    border-bottom: 1px solid var(--surface-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-icon-badge {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surface-border);
    padding: 0.4rem 0.6rem;
    border-radius: 10px;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.form-legend {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-style: italic;
}

.required-star {
    color: #ef4444;
    font-weight: 700;
    margin-left: 0.2rem;
}

.form-error-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.2s ease-out;
}

.date-picker-input {
    color-scheme: dark;
    font-family: inherit;
    cursor: pointer;
}

.date-picker-input::-webkit-calendar-picker-indicator {
    filter: invert(0.8) sepia(1) saturate(5) hue-rotate(185deg);
    cursor: pointer;
}

.badge-protected {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.2);
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    opacity: 0.5;
}


