/**
 * BEERDUINO Web Edition - Styles
 * Версия 1.0
 */

/* ==================== VARIABLES ==================== */
:root {
    --primary: #e94560;
    --primary-dark: #c73e54;
    --secondary: #0f3460;
    --accent: #16213e;
    --background: #1a1a2e;
    --background-light: #16213e;
    --card: rgba(255, 255, 255, 0.05);
    --card-hover: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
}

/* ==================== RESET ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, var(--accent) 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ==================== LAYOUT ==================== */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ==================== HEADER ==================== */
.header {
    background: var(--card);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.logo-icon {
    font-size: 2rem;
}

.nav {
    display: flex;
    gap: 5px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background: var(--card);
    color: var(--text);
}

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

/* ==================== MAIN ==================== */
.main {
    flex: 1;
    padding: 30px 0;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ==================== CARDS ==================== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==================== STATUS DISPLAY ==================== */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.status-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.status-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.status-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.status-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Temperature display */
.temp-display {
    position: relative;
}

.temp-display .status-value {
    font-size: 3.5rem;
}

.temp-display .unit {
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* ==================== RELAY STATUS ==================== */
.relay-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.relay-item {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 15px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.relay-item.on {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.1);
}

.relay-item.off {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.relay-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.relay-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.relay-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.relay-item.on .relay-status {
    color: var(--success);
}

.relay-item.off .relay-status {
    color: var(--danger);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

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

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

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 20px;
}

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

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* ==================== PROGRESS ==================== */
.progress-container {
    margin-bottom: 20px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.progress-bar {
    height: 12px;
    background: var(--card);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 6px;
    transition: width 0.5s ease;
}

/* ==================== STEPS LIST ==================== */
.steps-list {
    list-style: none;
}

.step-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--card);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border-left: 4px solid transparent;
}

.step-item.completed {
    border-left-color: var(--success);
    opacity: 0.7;
}

.step-item.active {
    border-left-color: var(--primary);
    background: rgba(233, 69, 96, 0.1);
}

.step-item.pending {
    border-left-color: var(--border);
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-weight: 600;
}

.step-item.completed .step-number {
    background: var(--success);
    color: var(--background);
}

.step-item.active .step-number {
    background: var(--primary);
    color: white;
}

.step-content {
    flex: 1;
}

.step-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.step-details {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ==================== RECIPE CARDS ==================== */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.recipe-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.recipe-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.recipe-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.recipe-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.recipe-meta {
    display: flex;
    gap: 15px;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.recipe-actions {
    display: flex;
    gap: 10px;
}

/* ==================== TABLE ==================== */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--card);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tr:hover td {
    background: var(--card);
}

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--background-light);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.modal-close:hover {
    color: var(--text);
}

/* ==================== ALERT ==================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-info {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.5);
}

.alert-success {
    background: rgba(74, 222, 128, 0.2);
    border: 1px solid rgba(74, 222, 128, 0.5);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.2);
    border: 1px solid rgba(251, 191, 36, 0.5);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
}

/* ==================== BADGE ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.2);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

/* ==================== CHART ==================== */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

/* ==================== LOADING ==================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== OFFLINE INDICATOR ==================== */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--danger);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.offline-indicator.visible {
    opacity: 1;
    visibility: visible;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-link {
        padding: 6px 12px;
        font-size: 0.875rem;
    }
    
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .relay-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .status-value {
        font-size: 2rem;
    }
    
    .temp-display .status-value {
        font-size: 2.5rem;
    }
    
    .recipes-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .card {
        padding: 16px;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
    }
    
    .relay-grid {
        grid-template-columns: 1fr 1fr;
    }
}
