/* AI MakeWare Unified Platform Styles */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #0f172a;
    --accent: #10b981;
    --accent-hover: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Navigation */
.header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--secondary);
}

.logo-badge {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    letter-spacing: -0.5px;
}

.logo-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.logo-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 0.25rem;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
    cursor: pointer;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-accent {
    background-color: var(--accent);
    color: white;
}
.btn-accent:hover { background-color: var(--accent-hover); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-main);
}
.btn-outline:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 0.85rem 1.6rem;
    font-size: 1.05rem;
    border-radius: 10px;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
    padding: 3.5rem 1.5rem 2.5rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.hero-container {
    max-width: 900px;
    margin: 0 auto;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #dbeafe;
    color: #1e40af;
    padding: 0.35rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.25;
    color: #0f172a;
    margin-bottom: 1rem;
    letter-spacing: -0.8px;
}

.hero-title span {
    color: var(--primary);
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 720px;
    margin: 0 auto 2rem;
}

.hero-connection-bar {
    background: #ffffff;
    border: 2px solid #bfdbfe;
    border-radius: 16px;
    padding: 1.25rem 1.75rem;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 820px;
    margin: 0 auto;
}

.status-indicator-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
}

.status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #94a3b8;
    position: relative;
}

.status-dot.connected {
    background-color: #10b981;
    box-shadow: 0 0 12px #10b981;
}

.status-dot.connected::after {
    content: '';
    position: absolute;
    top: -3px; left: -3px; right: -3px; bottom: -3px;
    border-radius: 50%;
    border: 2px solid #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

.status-text-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #0f172a;
}

.status-text-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Main Content Layout */
.main-container {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    width: 100%;
    flex: 1;
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 960px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Card Component */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-badge {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

/* Hardware Visualizer & Pin Map */
.board-visualizer {
    background: #0f172a;
    border-radius: 12px;
    padding: 1.5rem;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.board-schematic {
    width: 100%;
    max-width: 420px;
    background: #1e293b;
    border: 3px solid #334155;
    border-radius: 16px;
    padding: 1.5rem 1.25rem;
    position: relative;
}

.board-top-label {
    text-align: center;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: #60a5fa;
    margin-bottom: 1rem;
}

.board-pins-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.pin-chip {
    background: #334155;
    border: 1px solid #475569;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.pin-chip:hover {
    background: #475569;
    color: #ffffff;
    border-color: #60a5fa;
}

.pin-chip.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.7);
}

.led-indicator-row {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1.25rem 0;
    padding: 0.85rem;
    background: #0f172a;
    border-radius: 10px;
    border: 1px solid #334155;
}

.led-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.led-bulb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #475569;
    transition: all 0.2s;
}

.led-bulb.red { background: #450a0a; border-color: #7f1d1d; }
.led-bulb.red.on {
    background: #ef4444;
    border-color: #fca5a5;
    box-shadow: 0 0 16px #ef4444, 0 0 30px #ef4444;
}

.led-bulb.green { background: #052e16; border-color: #14532d; }
.led-bulb.green.on {
    background: #22c55e;
    border-color: #86efac;
    box-shadow: 0 0 16px #22c55e, 0 0 30px #22c55e;
}

/* Diagnostic Controls Grid */
.diagnostic-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.ctrl-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ctrl-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Motor Slider */
.motor-slider-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.motor-slider {
    flex: 1;
    accent-color: var(--primary);
}

/* Flash Progress Box */
.flash-progress-card {
    background: #0f172a;
    color: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
    display: none;
}

.flash-progress-card.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.progress-bar-bg {
    background: #334155;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.progress-bar-fill {
    background: linear-gradient(90deg, #3b82f6, #10b981);
    height: 100%;
    width: 0%;
    transition: width 0.2s ease-out;
}

/* Preset Cards */
.preset-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.preset-item {
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.preset-item:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

.preset-info {
    max-width: 70%;
}

.preset-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.preset-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Driver Download Section */
.driver-section {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.driver-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.25rem;
}

.driver-card {
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    background: #f8fafc;
    transition: all 0.2s;
}

.driver-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.driver-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.driver-name {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

.driver-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* Footer */
.footer {
    background: #0f172a;
    color: #94a3b8;
    padding: 3rem 1.5rem 2rem;
    border-top: 1px solid #1e293b;
    margin-top: auto;
}

.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-brand {
    max-width: 380px;
}

.footer-logo {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.footer-info {
    font-size: 0.85rem;
    line-height: 1.7;
}

.footer-info a {
    color: #60a5fa;
    text-decoration: none;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 540px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.open .modal-box {
    transform: scale(1);
}

/* Admin Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 1rem;
}

.data-table th {
    background: #f1f5f9;
    color: #475569;
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: #334155;
}

.data-table tr:hover {
    background: #f8fafc;
}

.badge-success { background: #dcfce7; color: #166534; padding: 0.2rem 0.5rem; border-radius: 4px; font-weight: 700; font-size: 0.75rem; }
.badge-warning { background: #fef3c7; color: #92400e; padding: 0.2rem 0.5rem; border-radius: 4px; font-weight: 700; font-size: 0.75rem; }
.badge-danger { background: #fee2e2; color: #991b1b; padding: 0.2rem 0.5rem; border-radius: 4px; font-weight: 700; font-size: 0.75rem; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
