/**
 * Common Styles
 * Shared variables and base styles
 */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #3b4a63;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #06b6d4;
    
    --border: #334155;
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
}

/* Page center layout */
.page-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

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

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

small {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-group-btn {
    display: flex;
    align-items: flex-end;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

legend {
    padding: 0 10px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary { background: var(--accent); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); }
.btn-error { background: var(--error); }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--bg-tertiary); }
.btn-secondary:hover { background: var(--bg-hover); }

.btn-block { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* Installer Warning - компактная плашка */
.installer-warning {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.installer-warning-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.installer-warning-text {
    flex: 1;
    font-size: 0.9rem;
    color: #fcd34d;
}

.installer-warning-text strong {
    color: var(--warning);
}

.installer-warning-form {
    flex-shrink: 0;
}

.btn-icon {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover { background: var(--accent); }
.btn-icon.btn-danger:hover { background: var(--error); }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

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

.badge-success { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-error { background: rgba(239, 68, 68, 0.2); color: var(--error); }
.badge-info { background: rgba(6, 182, 212, 0.2); color: var(--info); }

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.card-success {
    border-color: var(--success);
}

/* Table */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.table th {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}

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

.table code {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
}

.table .empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.table .details {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.table .actions {
    display: flex;
    gap: 6px;
}

.inline {
    display: inline;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.page-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
}

.page-item:hover { background: var(--bg-tertiary); }
.page-item.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Utility */
.output {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
}

.result-header {
    margin-bottom: 16px;
    color: var(--success);
    font-weight: 500;
}

@media (max-width: 768px) {
    .form-row { flex-direction: column; }
}
