/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', 'Consolas', 'Courier New', monospace;
    background-color: #0d1117;
    color: #f0f6fc;
    line-height: 1.6;
    min-height: 100vh;
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
header {
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #30363d;
    background: linear-gradient(135deg, #161b22 0%, #0d1117 100%);
    border-radius: 6px;
    padding: 10px 12px 8px;
}

header h1 {
    font-size: 1.2rem;
    margin-bottom: 4px;
    color: #58a6ff;
    font-weight: 700;
    letter-spacing: -0.02em;
}

header p {
    color: #8b949e;
    font-size: 0.7rem;
    font-weight: 400;
    margin: 0;
}

/* Main content area */
main {
    flex: 1;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 14px;
    align-items: start;
}

/* Editor section */
.editor-section {
    background: #161b22;
    padding: 12px;
    border: 1px solid #30363d;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    height: 600px;
    display: flex;
    flex-direction: column;
}

.editor-section:hover {
    border-color: #58a6ff;
    box-shadow: 0 8px 32px rgba(88, 166, 255, 0.1);
}

.editor-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #f0f6fc;
    font-size: 0.9rem;
}

#notepad {
    width: 100%;
    flex: 1;
    min-height: 500px;
    padding: 16px;
    border: 1px solid #30363d;
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background-color: #0d1117;
    color: #f0f6fc;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
}

#notepad:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
    background-color: #010409;
}

#notepad::placeholder {
    color: #6e7681;
}

/* Combined Status & Analytics panel */
.combined-panel {
    background: #161b22;
    padding: 12px;
    border: 1px solid #30363d;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    position: sticky;
    top: 20px;
    height: 600px;
    transition: all 0.2s ease;
}

.combined-panel:hover {
    border-color: #58a6ff;
    box-shadow: 0 8px 32px rgba(88, 166, 255, 0.1);
}

.combined-panel h2 {
    margin-bottom: 10px;
    color: #58a6ff;
    font-size: 1.1rem;
    text-align: center;
    border-bottom: 1px solid #30363d;
    padding-bottom: 8px;
    font-weight: 700;
}

.combined-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(8, 1fr);
    gap: 6px;
    height: calc(100% - 60px);
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 4px;
    transition: all 0.2s ease;
    justify-content: center;
    min-height: 0;
}

.metric-item:hover {
    border-color: #30363d;
    background: #010409;
}

.metric-item label {
    font-weight: 600;
    color: #8b949e;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.metric-item span {
    padding: 6px 8px;
    background-color: #21262d;
    border: 1px solid #30363d;
    border-radius: 3px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', 'Consolas', 'Courier New', monospace;
    font-size: 0.8rem;
    color: #f0f6fc;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Focus status styling */
.focus-active {
    background-color: #0d4429 !important;
    border-color: #1a7f37 !important;
    color: #3fb950 !important;
    box-shadow: 0 0 0 1px rgba(63, 185, 80, 0.2) !important;
}

.focus-inactive {
    background-color: #490202 !important;
    border-color: #da3633 !important;
    color: #f85149 !important;
    box-shadow: 0 0 0 1px rgba(248, 81, 73, 0.2) !important;
}

/* Proximity status styling */
.proximity-near {
    background-color: #7d4e00 !important;
    border-color: #d29922 !important;
    color: #f2cc60 !important;
    box-shadow: 0 0 0 1px rgba(242, 204, 96, 0.2) !important;
}

/* Old analytics CSS removed - now using combined panel */

.analytics-item:hover {
    border-color: #30363d;
    background: #010409;
}

.analytics-item label {
    font-weight: 600;
    color: #8b949e;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.analytics-item span {
    padding: 6px 8px;
    background-color: #21262d;
    border: 1px solid #30363d;
    border-radius: 3px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', 'Consolas', 'Courier New', monospace;
    font-size: 0.8rem;
    color: #f0f6fc;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Analytics status styling */
.analytics-active {
    background-color: #0d4429 !important;
    border-color: #1a7f37 !important;
    color: #3fb950 !important;
    box-shadow: 0 0 0 1px rgba(63, 185, 80, 0.2) !important;
}

.analytics-warning {
    background-color: #7d4e00 !important;
    border-color: #d29922 !important;
    color: #f2cc60 !important;
    box-shadow: 0 0 0 1px rgba(242, 204, 96, 0.2) !important;
}

.analytics-high {
    background-color: #490202 !important;
    border-color: #da3633 !important;
    color: #f85149 !important;
    box-shadow: 0 0 0 1px rgba(248, 81, 73, 0.2) !important;
}

/* Footer */
footer {
    margin-top: 12px;
    padding: 10px;
    border-top: 1px solid #30363d;
    text-align: center;
    color: #8b949e;
    font-size: 0.75rem;
    background: #161b22;
    border-radius: 6px;
}

footer p {
    margin-bottom: 4px;
    line-height: 1.3;
}

footer a {
    color: #58a6ff;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

footer a:hover {
    color: #79c0ff;
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 8px;
    }

    main {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .combined-panel {
        position: static;
        height: auto;
        max-height: 400px;
        padding: 12px;
        order: -1;
    }

    #notepad {
        min-height: 140px;
        max-height: 180px;
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px;
    }

    header {
        padding: 10px 8px 8px;
        margin-bottom: 10px;
    }

    header h1 {
        font-size: 1.2rem;
    }

    header p {
        font-size: 0.75rem;
    }

    .status-grid,
    .analytics-grid {
        gap: 8px;
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, auto);
        height: auto;
    }

    .analytics-grid {
        grid-template-rows: repeat(6, auto);
    }

    .status-item,
    .analytics-item {
        padding: 8px;
    }

    .status-item span,
    .analytics-item span {
        font-size: 0.9rem;
        padding: 8px 10px;
    }

    .status-item label,
    .analytics-item label {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 6px;
    }

    .editor-section,
    .status-panel {
        padding: 8px;
    }

    #notepad {
        min-height: 120px;
        max-height: 160px;
        font-size: 16px;
        padding: 8px;
    }

    header {
        padding: 8px 6px 6px;
        margin-bottom: 8px;
    }

    header h1 {
        font-size: 1.1rem;
        margin-bottom: 4px;
    }

    header p {
        font-size: 0.7rem;
    }

    .status-panel,
    .ux-analytics-panel {
        height: auto;
        max-height: 180px;
    }

    .status-panel h2 {
        font-size: 1rem;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .status-item span {
        font-size: 0.75rem;
        padding: 4px 6px;
    }

    .status-item label {
        font-size: 0.7rem;
    }

    .status-grid {
        gap: 4px;
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, auto);
    }

    footer {
        padding: 6px;
        margin-top: 8px;
        font-size: 0.65rem;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .status-panel,
    .editor-section {
        border-width: 2px;
    }

    #notepad:focus {
        box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.4);
    }
}
