:root {
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --bg: #0F1219;
    --bg-surface: #1E2330;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --border: #334155;
    --radius: 12px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header & Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background-color: rgba(30, 35, 48, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.controls {
    display: flex;
    gap: 24px;
    align-items: center;
}

.input-group {
    display: flex;
    gap: 8px;
}

input[type="url"],
input[type="text"],
input[type="number"] {
    background-color: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    width: 300px;
    transition: var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.control-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

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

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

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

.btn-secondary:hover {
    background-color: var(--bg-surface);
    border-color: var(--text-muted);
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Workspace area */
.workspace {
    flex: 1;
    display: flex;
    gap: 32px;
    padding: 32px;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: flex-start;
}

/* Viewport Card */
.viewport-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
    background: rgba(30, 35, 48, 0.4);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    height: 100%;
}

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

.viewport-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.viewport-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.viewport-actions {
    display: flex;
    gap: 8px;
}

/* Device Frame Wrapper */
.device-frame {
    position: relative;
    border: 8px solid #111;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background-color: white;
    transition: var(--transition);
}

.device-frame.desktop-frame {
    border-width: 12px 12px 0 12px;
    border-radius: 12px 12px 0 0;
}

iframe {
    border: none;
    width: 100%;
    height: 100%;
    background-color: white;
    display: block;
}

/* Overlay Grid */
.grid-overlay .device-frame::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: 20px 20px;
    background-image:
        linear-gradient(to right, rgba(99, 102, 241, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(99, 102, 241, 0.1) 1px, transparent 1px);
    pointer-events: none;
    z-index: 10;
}

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

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

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

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 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.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal h2 {
    margin-bottom: 20px;
    font-size: 1.25rem;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.modal-body .input-group {
    flex-direction: column;
    align-items: stretch;
}

.modal-body .input-group input {
    width: 100%;
}

.size-inputs {
    display: flex;
    gap: 12px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Status Indicator */
.status-badge {
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.7rem;
}

.status-badge.loading {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.status-badge.ready {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.status-badge.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}