/* static/style.css */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #10b981;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --error-color: #ef4444;
    --success-color: #10b981;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    padding: 0;
    margin: 0;
    min-height: 100vh;
}

/* Контейнеры */
.container {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    margin: 0 auto;
}

.card {
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

/* Навигация и заголовки */
.header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.username {
    font-weight: 500;
    color: var(--text-primary);
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="time"],
select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px; /* Предотвращает zoom на iOS */
    background: var(--surface-color);
    transition: all 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    min-height: 52px; /* Минимальная высота для touch */
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--text-secondary);
}

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

/* Списки и карточки */
.frames-grid {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.frame-card {
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.frame-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.frame-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.frame-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.frame-id {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.frame-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-inactive {
    background: #fef2f2;
    color: #991b1b;
}

.frame-details {
    display: grid;
    gap: 8px;
    margin: 16px 0;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.detail-value {
    font-weight: 500;
}

.frame-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
}

/* Уведомления */
.alert {
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-error {
    background: #fef2f2;
    border-left-color: var(--error-color);
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    border-left-color: var(--success-color);
    color: #166534;
}

/* Навигационные табы */
.tabs {
    display: flex;
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tab.active {
    background: var(--primary-color);
    color: white;
}

/* Форма добавления рамки */
.add-frame-form {
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 2px dashed var(--border-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

/* История задач */
.task-list {
    display: grid;
    gap: 8px;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface-color);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.task-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-processing {
    background: #fef3c7;
    color: #92400e;
}

.status-failed {
    background: #fef2f2;
    color: #991b1b;
}

/* Аутентификация */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.auth-title {
    text-align: center;
    margin-bottom: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-subtitle {
    text-align: center;
    margin-bottom: 32px;
    color: var(--text-secondary);
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .card {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .frame-actions {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .user-menu {
        flex-direction: column;
        gap: 8px;
    }
}

/* Улучшения для touch */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }
    
    .frame-card:hover {
        transform: none;
    }
    
    input, select, textarea {
        font-size: 16px; /* Предотвращает zoom на iOS */
    }
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Загрузка */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
/* Дополнения к существующему CSS */

.status-processing {
    background: #fef3c7;
    color: #92400e;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.task-item {
    transition: all 0.3s ease;
}

.task-item:hover {
    transform: translateX(5px);
}

/* Стили для разделителя */
.task-divider {
    text-align: center;
    padding: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 2px dashed var(--border-color);
    margin: 10px 0;
}

.task-divider {
    text-align: center;
    padding: 12px 16px;
    margin: 16px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
}