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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

.container {
    width: 100%;
    max-width: 450px;
}

.card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideIn 0.5s ease-out;
    margin-bottom: 20px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

h1 {
    color: #333;
    margin-bottom: 10px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
}

h1 i {
    margin-right: 10px;
    color: #667eea;
}

.subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    font-size: 16px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

input, textarea, select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    background: #f8fafc;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.button-secondary {
    background: #f1f5f9;
    color: #475569;
    margin-top: 15px;
    border: 2px solid #e2e8f0;
}

.button-secondary:hover:not(:disabled) {
    background: #e2e8f0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.toggle-auth {
    text-align: center;
    margin-top: 25px;
    color: #64748b;
    font-size: 14px;
}

.toggle-auth a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.toggle-auth a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.code-inputs {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

.code-input {
    flex: 1;
    height: 70px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
}

.message {
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.message.info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.message.warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.dashboard {
    text-align: center;
}

.user-info {
    margin: 25px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 15px;
    border: 1px solid #e2e8f0;
}

.user-info p {
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.user-info strong {
    color: #475569;
}

.logout-btn {
    background: #ef4444;
    margin-top: 20px;
}

.logout-btn:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

.footer-info {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin-top: 20px;
}

.footer-info a {
    color: white;
    text-decoration: none;
}

.footer-info a:hover {
    text-decoration: underline;
}

/* Procedures Page Styles */
.procedures-list {
    margin: 20px 0;
}

.procedures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.procedure-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s ease;
}

.procedure-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.procedure-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.procedure-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.procedure-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.procedure-description {
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.6;
}

.procedure-schema {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.procedure-schema h4 {
    margin-top: 0;
    color: #475569;
    font-size: 16px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.param-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.param-list li {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.param-list li:last-child {
    border-bottom: none;
}

.param-list strong {
    color: #334155;
    display: block;
    margin-bottom: 5px;
}

.param-list small {
    color: #64748b;
    font-size: 12px;
    display: block;
    line-height: 1.4;
}

.procedure-test-btn {
    width: 100%;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.procedure-test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(14, 165, 233, 0.3);
}

/* System Status */
.system-status {
    margin-bottom: 25px;
}

.status-card {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid;
    border-radius: 15px;
    padding: 20px;
    gap: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.status-good {
    border-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.status-warn {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.status-icon {
    font-size: 40px;
}

.status-good .status-icon {
    color: #10b981;
}

.status-warn .status-icon {
    color: #f59e0b;
}

.status-details h4 {
    margin: 0 0 10px 0;
    color: #1e293b;
    font-size: 18px;
}

.status-details p {
    margin: 6px 0;
    color: #475569;
    font-size: 14px;
}

.status-details strong {
    color: #334155;
}

/* Test Controls */
.test-controls {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    padding: 25px;
    margin: 25px 0;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 20px;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.form-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
    font-style: italic;
}

/* Test Results */
.test-result {
    margin-top: 25px;
    padding: 25px;
    border-radius: 15px;
    border-left: 5px solid;
    animation: fadeIn 0.5s ease;
}

.test-result.success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left-color: #10b981;
    color: #065f46;
}

.test-result.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left-color: #ef4444;
    color: #991b1b;
}

.test-result h4 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    margin-bottom: 15px;
}

.test-result .result-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
}

.data-preview {
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.data-preview pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 13px;
    line-height: 1.4;
    color: #334155;
}

/* Actions */
.actions {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #e2e8f0;
    gap: 15px;
}

.actions button {
    flex: 1;
}

/* Dashboard Updates */
.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.dashboard-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
    background: white;
}

.dashboard-card i {
    font-size: 36px;
    color: #667eea;
    margin-bottom: 15px;
}

.dashboard-card h3 {
    margin: 0 0 10px 0;
    color: #334155;
    font-size: 16px;
}

.dashboard-card p {
    color: #64748b;
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

/* Timer styles */
.timer-container {
    background: #f8fafc;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    margin: 20px 0;
}

.timer {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    font-family: monospace;
}

.timer-label {
    color: #64748b;
    font-size: 14px;
    margin-top: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
    }
    
    .card {
        padding: 25px;
    }
    
    .procedures-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-actions {
        grid-template-columns: 1fr;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .code-inputs {
        gap: 8px;
    }
    
    .code-input {
        height: 60px;
        font-size: 24px;
    }
}

/* Animation for code input focus */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

.code-input:focus {
    animation: pulse 1.5s infinite;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}