/* === Root Variables === */
:root {
    --primary: #00d4ff;
    --primary-dark: #0099cc;
    --success: #00ff88;
    --error: #ff4466;
    --warning: #ffaa00;
    --bg-dark: #0a0e27;
    --bg-card: #1a1a2e;
    --bg-hover: #2a2a3e;
    --text-primary: #e8f4f8;
    --text-secondary: #a0b0c0;
    --border-color: #2a3a4a;
    --shadow: 0 8px 32px rgba(0, 212, 255, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Global Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* === Container === */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* === Header === */
.header {
    margin-bottom: 40px;
    padding: 30px 0;
    border-bottom: 2px solid var(--border-color);
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.3));
}

.header-text h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, #00ff88 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.header-text p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* === Main Content === */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* === Cards === */
.installer-card,
.info-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-section {
    padding: 30px;
    border-bottom: 1px solid var(--border-color);
}

.card-section:last-child {
    border-bottom: none;
}

.card-section h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.card-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
}

.section-subtitle {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 14px;
}

/* === Form Elements === */
.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 14px;
}

.required {
    color: var(--error);
}

.select-wrapper {
    position: relative;
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    transition: var(--transition);
    padding-right: 40px;
}

.form-select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 16px rgba(0, 212, 255, 0.3);
}

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

.select-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    pointer-events: none;
    color: var(--text-secondary);
}

/* === Board Info === */
.board-info {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-dark);
    border-radius: 8px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.board-image {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    background: var(--bg-card);
    padding: 5px;
}

.board-details {
    flex: 1;
}

.board-details p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0;
}

.board-details strong {
    color: var(--text-primary);
}

/* === Status Box === */
.status-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-dark);
    border-left: 3px solid var(--text-secondary);
    border-radius: 6px;
    margin-bottom: 20px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: pulse 2s infinite;
}

.status-box.connected .status-indicator {
    background: var(--success);
}

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

.status-text {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-label {
    color: var(--text-secondary);
    font-size: 13px;
}

.status-value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
}

/* === Buttons === */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 25px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: none;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #00ff88 100%);
    color: #000;
    font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #00ff88 0%, #00cc66 100%);
    color: #000;
    font-weight: 700;
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    transform: translateY(-2px);
}

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

.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

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

/* === Progress Section === */
.progress-section {
    background: var(--bg-dark);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #00ff88 100%);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* === Log Area === */
.log-container {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 300px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    font-size: 13px;
    font-weight: 500;
}

.log-clear-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.log-clear-btn:hover {
    color: var(--primary);
}

.log-area {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
}

.log-entry {
    margin-bottom: 4px;
    padding: 2px 0;
    word-break: break-word;
}

.log-entry.info {
    color: var(--text-secondary);
}

.log-entry.success {
    color: var(--success);
}

.log-entry.error {
    color: var(--error);
}

.log-entry.warning {
    color: var(--warning);
}

/* === Success Section === */
.success-section {
    text-align: center;
    padding: 40px 30px;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.success-info {
    margin-bottom: 30px;
}

.ap-info {
    background: var(--bg-dark);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 3px solid var(--success);
}

.ap-info p {
    margin: 6px 0;
    font-size: 14px;
}

.ap-ssid code {
    background: var(--bg-card);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--primary);
    font-size: 13px;
}

.ap-note {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 10px;
}

/* === Error Section === */
.error-section {
    text-align: center;
    padding: 40px 30px;
}

.error-icon {
    font-size: 64px;
    color: var(--error);
    margin-bottom: 20px;
}

.error-message {
    background: var(--bg-dark);
    border-left: 3px solid var(--error);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: left;
    font-size: 14px;
    color: var(--text-secondary);
}

.error-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* === Warning === */
.warning {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid var(--warning);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    color: var(--warning);
}

.warning h3 {
    margin-bottom: 10px;
}

.warning ul {
    margin-left: 20px;
}

.warning li {
    margin-bottom: 6px;
}

/* === Info Section === */
.info-section {
    padding: 20px 30px;
}

.info-section h3 {
    margin-bottom: 15px;
    color: var(--primary);
}

.info-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-list li {
    padding-left: 25px;
    position: relative;
    font-size: 14px;
    color: var(--text-secondary);
}

.info-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

/* === Footer === */
.footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

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

/* === Utility Classes === */
.hidden {
    display: none !important;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        margin-bottom: 25px;
        padding: 20px 0;
    }

    .logo-section {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .logo {
        width: 50px;
        height: 50px;
    }

    .header-text h1 {
        font-size: 24px;
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    .card-section {
        padding: 20px;
    }

    .main-content {
        gap: 20px;
    }

    .board-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .error-actions {
        grid-template-columns: 1fr;
    }

    .log-container {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .header-text h1 {
        font-size: 20px;
    }

    .card-section h2 {
        font-size: 18px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .status-box {
        flex-direction: column;
        gap: 8px;
        border-left: none;
        border-top: 3px solid var(--text-secondary);
    }
}
