/* PyMoji Playground Styles */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #333;
    border-top: 4px solid #00d9ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.2em;
    color: #00d9ff;
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px;
}

/* Header */
.header {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    margin-bottom: 15px;
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 2.2em;
    background: linear-gradient(135deg, #00d9ff, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.header p {
    color: #aaa;
    font-size: 1em;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
}

.status-dot.ready {
    background: #00ff88;
    box-shadow: 0 0 10px #00ff88;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 280px 1fr 1fr;
    gap: 15px;
    min-height: calc(100vh - 180px);
}

/* Panel Base */
.panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.panel-header {
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Emoji Palette */
.emoji-palette {
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.emoji-palette-content {
    padding: 10px;
}

.emoji-category {
    margin-bottom: 15px;
}

.category-title {
    font-size: 0.8em;
    color: #00d9ff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(0, 217, 255, 0.3);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.emoji-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.emoji-btn:hover {
    background: rgba(0, 217, 255, 0.2);
    border-color: #00d9ff;
    transform: scale(1.05);
}

.emoji-btn .emoji {
    font-size: 1.4em;
}

.emoji-btn .label {
    font-size: 0.65em;
    color: #888;
}

.emoji-btn:hover .label {
    color: #00d9ff;
}

/* Editor Panel */
.editor-panel {
    display: flex;
    flex-direction: column;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 8px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
}

.toolbar button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-run {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #000;
}

.btn-run:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
}

.btn-run:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-clear {
    background: rgba(255, 107, 107, 0.8);
    color: #fff;
}

.btn-clear:hover {
    background: #ff6b6b;
}

.btn-convert {
    background: rgba(0, 217, 255, 0.8);
    color: #000;
}

.btn-convert:hover {
    background: #00d9ff;
}

.btn-example {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.btn-example:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Editor Container */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

.editor-label {
    font-size: 0.75em;
    color: #00d9ff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

textarea {
    flex: 1;
    width: 100%;
    min-height: 200px;
    max-height: 800px;
    padding: 15px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 1em;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    resize: vertical;
    line-height: 1.6;
}

textarea:focus {
    outline: none;
    border-color: #00d9ff;
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

textarea::placeholder {
    color: #555;
}

/* Resize handle indicator */
textarea::-webkit-resizer,
.python-code::-webkit-resizer,
.output-console::-webkit-resizer {
    background: linear-gradient(135deg, transparent 40%, rgba(0, 217, 255, 0.5) 50%, transparent 60%);
    border-radius: 0 0 10px 0;
}

/* Drag and Drop Styling */
textarea.drag-over {
    border-color: #00ff88;
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.2);
    background: rgba(0, 255, 136, 0.05);
}

textarea.drag-over::before {
    content: "Drop Python file or code here";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #00ff88;
    font-size: 1.2em;
    pointer-events: none;
}

/* Python Preview */
.python-preview {
    margin-top: 15px;
    flex: 0 0 auto;
}

.python-code {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    color: #aaa;
    white-space: pre-wrap;
    min-height: 150px;
    max-height: 400px;
    height: 200px;
    overflow-y: auto;
    resize: vertical;
}

/* Output Panel */
.output-panel {
    display: flex;
    flex-direction: column;
}

.output-container {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.output-console {
    flex: 1;
    background: #0d0d0d;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
    overflow-y: auto;
    min-height: 300px;
    max-height: 800px;
    resize: vertical;
}

.output-line {
    margin-bottom: 3px;
}

.output-line.stdout {
    color: #00ff88;
}

.output-line.stderr {
    color: #ff6b6b;
}

.output-line.info {
    color: #00d9ff;
}

.output-line.result {
    color: #ffd93d;
}

.output-placeholder {
    color: #444;
    font-style: italic;
}

/* Examples Dropdown */
.examples-dropdown {
    position: relative;
}

.examples-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 5px 0;
    min-width: 180px;
    display: none;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.examples-dropdown:hover .examples-menu {
    display: block;
}

.example-item {
    padding: 8px 15px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85em;
}

.example-item:hover {
    background: rgba(0, 217, 255, 0.2);
}

/* Keyboard Shortcut Hint */
.shortcut-hint {
    font-size: 0.7em;
    color: #666;
    margin-left: auto;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 1fr 1fr;
    }

    .emoji-palette {
        grid-column: 1 / -1;
        max-height: 250px;
    }

    .emoji-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .header h1 {
        font-size: 1.8em;
    }

    .toolbar {
        flex-direction: column;
    }

    .toolbar button {
        width: 100%;
        justify-content: center;
    }
}
