/* ============================================
   Text Case Converter - PicMunk Design System
   ============================================ */

:root {
    /* Color System - Matches loremipsum.picmunk.com */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --border-color: #404040;
    --text-primary: #ffffff;
    --text-secondary: #adb5bd;
    --accent-color: #0d6efd;
    --accent-hover: #0b5ed7;
    --accent-success: #66BB6A;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-strong: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ============================================
   Base Styles
   ============================================ */

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

body#textcase {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ============================================
   Layout Structure
   ============================================ */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-container {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 20px;
    min-height: calc(100vh - 96px);
}

/* ============================================
   Sidebar Panel
   ============================================ */

.sidebar-panel {
    width: 320px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}

/* ============================================
   Conversion Buttons
   ============================================ */

.conversion-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-conversion {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-conversion:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-conversion:active {
    transform: translateY(0) scale(0.98);
}

/* Style Toggle */
.style-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
    padding: 0px 12px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.style-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.style-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 3px;
}

.toggle-option {
    padding: 6px 16px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-option:hover {
    color: var(--text-primary);
}

.toggle-option.active {
    background: var(--accent-color);
    color: white;
}

/* ============================================
   Action Buttons
   ============================================ */

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-full {
    width: 100%;
}

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

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

.btn-secondary {
    background: var(--accent-success);
    color: white;
    border-color: var(--accent-success);
}

.btn-secondary:hover {
    background: #5aa65a;
    border-color: #5aa65a;
}

.btn-clear {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-clear:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ============================================
   Content Panel
   ============================================ */

.content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 12px;
    height: fit-content;
}

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

.content-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.subtitle {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin: 0;
}

/* ============================================
   Text Editor
   ============================================ */

.editor-container {
    display: flex;
    flex-direction: column;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.char-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.text-editor {
    width: 100%;
    min-height: 400px;
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    cursor: text;
    user-select: text;
    transition: all 0.2s ease;
}

.text-editor:focus,
.text-editor:focus-within {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.text-editor::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

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

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-primary);
    border: 2px solid var(--accent-success);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow-strong);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.toast.show {
    display: flex;
}

.toast-icon {
    font-size: 20px;
    color: var(--accent-success);
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

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

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .sidebar-panel {
        width: 100%;
        position: static;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 12px;
    }

    .text-editor {
        min-height: 300px;
        font-size: 15px;
    }

    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 640px) {
    .text-editor {
        min-height: 250px;
        padding: 16px;
        font-size: 15px;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ============================================
   Accessibility
   ============================================ */

/* Focus visible styles */
*:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

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

/* ============================================
   Custom Scrollbar (Sidebar)
   ============================================ */

.sidebar-panel::-webkit-scrollbar {
    width: 8px;
}

.sidebar-panel::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

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

.sidebar-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}
