/* Intent Wheel 0.1 - Styles */
/* Restrained, instrument-like interface */

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #252525;
    --bg-tertiary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #606060;
    --accent-0: #0066cc;    /* Situate - Blue */
    --accent-1: #009999;    /* Formalize - Teal */
    --accent-2: #669900;    /* Locate - Green */
    --accent-3: #cc9900;    /* Build - Amber */
    --accent-4: #cc3300;    /* Freeze - Orange-Red */
    --accent-5: #9966cc;    /* Excavate - Purple */
    --accent-6: #cc3366;    /* Critique - Magenta */
    --accent-7: #3399cc;    /* Compare - Light Blue */
    --border-color: #3a3a3a;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.15s ease;
}

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

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ===== Textual Canvas ==== */

#canvas-container {
    flex: 1;
    padding: 20px;
    overflow: auto;
    background: var(--bg-primary);
}

#text-canvas {
    min-height: 100%;
    outline: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

#text-canvas:empty::before {
    content: attr(placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

#text-canvas:focus {
    border-color: var(--accent-0);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

/* ===== Intent Wheel Overlay ==== */

#wheel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

#wheel-overlay.hidden {
    display: none;
    pointer-events: none;
}

#wheel-center {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--text-muted);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}

#wheel-center::after {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.wheel-sector {
    position: absolute;
    width: 300px;
    height: 300px;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.7;
    overflow: hidden;
}

.wheel-sector::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    clip-path: inherit;
    transition: var(--transition);
}

.wheel-sector:hover {
    opacity: 1;
    background: var(--bg-secondary);
}

.wheel-sector:hover::before {
    opacity: 0.3;
}

.wheel-sector.highlight {
    opacity: 1;
    background: var(--bg-secondary);
}

.wheel-sector.highlight::before {
    opacity: 0.5;
}

/* Sector labels positioned around wheel */
.sector-label {
    position: absolute;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    text-align: center;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.sector-description {
    position: absolute;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    opacity: 0;
    transition: var(--transition);
    max-width: 100px;
}

.wheel-sector:hover .sector-description {
    opacity: 1;
}

/* Position sectors around wheel */
.wheel-sector[data-direction="0"] { transform: rotate(0deg) translateY(-150px) rotate(0deg); }
.wheel-sector[data-direction="0"] .sector-label { top: 120px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="0"] .sector-description { top: 140px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="0"] { background: var(--accent-0); background: linear-gradient(180deg, var(--accent-0) 0%, transparent 70%); }

.wheel-sector[data-direction="45"] { transform: rotate(45deg) translateY(-150px) rotate(-45deg); }
.wheel-sector[data-direction="45"] .sector-label { top: 120px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="45"] .sector-description { top: 140px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="45"] { background: var(--accent-1); background: linear-gradient(225deg, var(--accent-1) 0%, transparent 70%); }

.wheel-sector[data-direction="90"] { transform: rotate(90deg) translateY(-150px) rotate(-90deg); }
.wheel-sector[data-direction="90"] .sector-label { top: 120px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="90"] .sector-description { top: 140px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="90"] { background: var(--accent-2); background: linear-gradient(270deg, var(--accent-2) 0%, transparent 70%); }

.wheel-sector[data-direction="135"] { transform: rotate(135deg) translateY(-150px) rotate(-135deg); }
.wheel-sector[data-direction="135"] .sector-label { top: 120px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="135"] .sector-description { top: 140px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="135"] { background: var(--accent-3); background: linear-gradient(315deg, var(--accent-3) 0%, transparent 70%); }

.wheel-sector[data-direction="180"] { transform: rotate(180deg) translateY(-150px) rotate(-180deg); }
.wheel-sector[data-direction="180"] .sector-label { top: 120px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="180"] .sector-description { top: 140px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="180"] { background: var(--accent-4); background: linear-gradient(0deg, var(--accent-4) 0%, transparent 70%); }

.wheel-sector[data-direction="225"] { transform: rotate(225deg) translateY(-150px) rotate(-225deg); }
.wheel-sector[data-direction="225"] .sector-label { top: 120px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="225"] .sector-description { top: 140px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="225"] { background: var(--accent-5); background: linear-gradient(45deg, var(--accent-5) 0%, transparent 70%); }

.wheel-sector[data-direction="270"] { transform: rotate(270deg) translateY(-150px) rotate(-270deg); }
.wheel-sector[data-direction="270"] .sector-label { top: 120px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="270"] .sector-description { top: 140px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="270"] { background: var(--accent-6); background: linear-gradient(90deg, var(--accent-6) 0%, transparent 70%); }

.wheel-sector[data-direction="315"] { transform: rotate(315deg) translateY(-150px) rotate(-315deg); }
.wheel-sector[data-direction="315"] .sector-label { top: 120px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="315"] .sector-description { top: 140px; left: 50%; transform: translateX(-50%); }
.wheel-sector[data-direction="315"] { background: var(--accent-7); background: linear-gradient(135deg, var(--accent-7) 0%, transparent 70%); }

/* ===== Selection Indicator ==== */

#selection-indicator {
    position: fixed;
    pointer-events: none;
    z-index: 500;
    background: rgba(0, 102, 204, 0.15);
    border: 1px solid var(--accent-0);
    border-radius: var(--radius-sm);
}

#selection-indicator.hidden {
    display: none;
}

/* ===== Result Panel ==== */

#result-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    max-width: 800px;
    max-height: 80vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px var(--shadow-color);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#result-panel.hidden {
    display: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

#result-intent {
    font-weight: 600;
    font-size: 16px;
    color: var(--accent-0);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.btn-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.result-content {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

.result-section {
    margin-bottom: 20px;
}

.result-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.result-section pre {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow: auto;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.result-actions {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

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

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

.btn-primary:hover {
    background: var(--accent-0);
    filter: brightness(1.2);
}

/* ===== Attention History Panel ==== */

#attention-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 300px;
    max-height: 70vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px var(--shadow-color);
    z-index: 1500;
    display: flex;
    flex-direction: column;
}

#attention-panel.hidden {
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 13px;
    font-weight: 600;
}

#attention-list {
    flex: 1;
    overflow: auto;
    padding: 12px;
}

.attention-item {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    border-left: 2px solid var(--text-muted);
}

.attention-item:hover {
    border-left-color: var(--accent-0);
}

/* ===== Status Bar ==== */

#status-bar {
    height: 28px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 12px;
    gap: 20px;
}

#status-text {
    color: var(--text-secondary);
}

#status-hint {
    color: var(--text-muted);
    flex: 1;
    text-align: right;
}

/* ===== Toast ==== */

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--accent-0);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px var(--shadow-color);
    z-index: 3000;
}

.toast.hidden {
    display: none;
}

/* ===== Responsive: iPhone-fitting ==== */

@media (max-width: 600px) {
    #text-canvas {
        font-size: 13px;
        padding: 15px;
    }
    
    #wheel-overlay {
        /* Smaller wheel on mobile */
    }
    
    .wheel-sector {
        width: 200px;
        height: 200px;
    }
    
    #wheel-center {
        width: 40px;
        height: 40px;
    }
    
    .wheel-sector::before {
        display: none;
    }
    
    .sector-description {
        display: none;
    }
    
    #result-panel {
        width: 95vw;
        max-height: 90vh;
    }
    
    #attention-panel {
        width: 90vw;
        max-width: 300px;
        top: 10px;
        right: 10px;
    }
}

/* ===== Animations ==== */

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

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

#selection-indicator {
    animation: pulse 1.5s ease-in-out infinite;
}

#result-panel {
    animation: slideIn 0.2s ease-out;
}

/* ===== Syntax Highlighting ==== */

pre code {
    background: transparent;
    padding: 0;
}

.json-key { color: var(--accent-3); }
.json-string { color: var(--accent-2); }
.json-number { color: var(--accent-1); }
.json-boolean { color: var(--accent-6); }
.json-null { color: var(--text-muted); }

/* ===== Focus States ==== */

:focus-visible {
    outline: 2px solid var(--accent-0);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent-0);
    outline-offset: 2px;
}
