/* ByteSync Editor - CSS Styles */

:root {
    /* Default light theme colors */
    --theme-primary: #3b82f6;
    --theme-primaryHover: #2563eb;
    --theme-secondary: #6b7280;
    --theme-secondaryHover: #4b5563;
    --theme-background: #ffffff;
    --theme-surface: #f9fafb;
    --theme-surfaceHover: #f3f4f6;
    --theme-text: #111827;
    --theme-textSecondary: #6b7280;
    --theme-border: #e5e7eb;
    --theme-borderFocus: #3b82f6;
    --theme-success: #10b981;
    --theme-successHover: #059669;
    --theme-danger: #ef4444;
    --theme-dangerHover: #dc2626;
    --theme-warning: #f59e0b;
    --theme-warningHover: #d97706;
    --theme-input: #ffffff;
    --theme-inputFocus: #f0f9ff;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--theme-background);
    color: var(--theme-text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.theme-toggle-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--theme-surface);
    color: var(--theme-text);
    border: 1px solid var(--theme-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.theme-toggle-btn:hover {
    background-color: var(--theme-surfaceHover);
    border-color: var(--theme-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-icon {
    font-size: 1rem;
}

.theme-text {
    font-size: 0.875rem;
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

.tab-button {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    border: 2px solid transparent;
    position: relative;
}

.tab-button:hover {
    background-color: var(--theme-surfaceHover);
    border-color: var(--theme-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tab-button.active {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 2px var(--theme-primary);
    background-color: var(--theme-primary);
    color: white !important;
}

.tab-button.active:hover {
    background-color: var(--theme-primaryHover);
    border-color: var(--theme-primaryHover);
}

.input-cell {
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
    background-color: var(--theme-input);
    border: 1px solid var(--theme-border);
    border-radius: 4px;
    color: var(--theme-text);
    height: 32px;
    transition: all 0.2s ease;
    outline: none;
}

.input-cell:focus, .input-cell.highlight {
    background-color: var(--theme-inputFocus);
    border-color: var(--theme-borderFocus);
    box-shadow: 0 0 0 2px var(--theme-borderFocus);
}

/* Varsayılan değer CSS sınıfları kaldırıldı */

.input-cell.all-selected {
    background-color: var(--theme-primary);
    color: white;
    border-color: var(--theme-primary);
}

/* DevTools buton stilleri kaldırıldı */

.context-menu {
    position: fixed;
    background-color: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 150px;
    padding: 0.5rem 0;
    display: block;
}

.context-menu-item {
    padding: 0.5rem 1rem;
    color: var(--theme-text);
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.context-menu-item:hover {
    background-color: var(--theme-surfaceHover);
}

.context-menu-item.disabled {
    color: var(--theme-textSecondary);
    cursor: not-allowed;
}

.context-menu-item.disabled:hover {
    background-color: transparent;
}

.context-menu-separator {
    height: 1px;
    background-color: var(--theme-border);
    margin: 0.25rem 0;
}

.input-cell.ascii-cell { 
    width: 24px; 
    min-width: 24px;
    max-width: 24px;
}
.input-cell.hex-cell { 
    width: 32px; 
    min-width: 32px;
    max-width: 32px;
}
.input-cell.decimal-cell { 
    width: 40px; 
    min-width: 40px;
    max-width: 40px;
}
.input-cell.binary-cell { 
    width: 90px; 
    min-width: 90px;
    max-width: 90px;
}

.grid-container {
    display: grid;
    gap: 4px;
    width: 100%;
    max-width: 1200px; /* Sabit maksimum genişlik */
    margin: 0 auto;
}

/* Esnek grid düzeni - sığdığı kadar */
.grid-container.hex-grid {
    grid-template-columns: repeat(auto-fit, minmax(32px, max-content));
}
.grid-container.ascii-grid {
    grid-template-columns: repeat(auto-fit, minmax(24px, max-content));
}
.grid-container.decimal-grid {
    grid-template-columns: repeat(auto-fit, minmax(40px, max-content));
}
.grid-container.binary-grid {
    grid-template-columns: repeat(auto-fit, minmax(90px, max-content));
}

/* Light theme specific styles */
.theme-light {
    --theme-background: #ffffff;
    --theme-surface: #f9fafb;
    --theme-surfaceHover: #f3f4f6;
    --theme-text: #111827;
    --theme-textSecondary: #6b7280;
    --theme-border: #e5e7eb;
    --theme-input: #ffffff;
    --theme-inputFocus: #f0f9ff;
}

/* Dark theme specific styles */
.theme-dark {
    --theme-background: #1a1a1a;
    --theme-surface: #1f2937;
    --theme-surfaceHover: #374151;
    --theme-text: #f9fafb;
    --theme-textSecondary: #d1d5db;
    --theme-border: #374151;
    --theme-input: #2b2b2b;
    --theme-inputFocus: #4b4b4b;
}

/* Light theme tab button styles */
.theme-light .tab-button:not(.active) {
    background-color: #f8fafc !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}

.theme-light .tab-button:not(.active):hover {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}

/* Dark theme tab button styles */
.theme-dark .tab-button:not(.active) {
    background-color: #111827 !important;
    color: #6b7280 !important;
    border-color: #374151 !important;
}

.theme-dark .tab-button:not(.active):hover {
    background-color: #1f2937 !important;
    color: #9ca3af !important;
    border-color: #4b5563 !important;
}

/* Görsel Karakter Gösterimi Stilleri */
.control-char {
    background-color: #fef3c7;
    color: #92400e;
    padding: 1px 3px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    border: 1px solid #f59e0b;
}

.theme-dark .control-char {
    background-color: #451a03;
    color: #fbbf24;
    border-color: #f59e0b;
}

.extended-char {
    background-color: #dbeafe;
    color: #1e40af;
    padding: 1px 3px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: 500;
    font-family: 'Courier New', monospace;
    border: 1px solid #3b82f6;
}

.theme-dark .extended-char {
    background-color: #1e3a8a;
    color: #93c5fd;
    border-color: #3b82f6;
}

.null-char {
    background-color: #f3f4f6;
    color: #6b7280;
    padding: 1px 3px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    border: 1px solid #9ca3af;
}

.theme-dark .null-char {
    background-color: #374151;
    color: #9ca3af;
    border-color: #6b7280;
}

/* ASCII input hücreleri için özel stiller */
.ascii-input {
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* Görsel karakter tooltip'leri */
.char-tooltip {
    position: relative;
    cursor: help;
}

.char-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
}

.char-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 4-in-1 Mode Textarea Resize Styling */
#four-in-one-ascii,
#four-in-one-hex,
#four-in-one-decimal,
#four-in-one-binary {
    resize: both;
    min-height: 15rem; /* 128px - h-32 equivalent */
    min-width: 100%;
    max-width: 100%;
    border-radius: 1rem;
}

/* Custom resize handle styling */
#four-in-one-ascii::-webkit-resizer,
#four-in-one-hex::-webkit-resizer,
#four-in-one-decimal::-webkit-resizer,
#four-in-one-binary::-webkit-resizer {
    background: var(--theme-border);
    border-radius: 0 0 0.25rem 0;
    border: 1px solid var(--theme-border);
}

/* Firefox resize handle styling */
#four-in-one-ascii,
#four-in-one-hex,
#four-in-one-decimal,
#four-in-one-binary {
    scrollbar-width: thin;
    scrollbar-color: var(--theme-border) transparent;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    #four-in-one-ascii,
    #four-in-one-hex,
    #four-in-one-decimal,
    #four-in-one-binary {
        min-height: 6rem; /* Smaller min height on mobile */
    }
}

/* ASCII Reference Table Styles */
#ascii-table-body tr {
    transition: background-color 0.2s ease;
}

#ascii-table-body tr:hover {
    background-color: var(--theme-surfaceHover) !important;
}

#ascii-table-body td {
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Decimal cells with distinctive background color */
#ascii-table-body td.decimal-cell {
    color: var(--theme-text);
    font-weight: 700;
    font-size: 1rem;
    background-color: rgba(59, 130, 246, 0.20) !important;
}

.theme-dark #ascii-table-body td.decimal-cell {
    background-color: rgba(59, 130, 246, 0.25) !important;
}

/* Table header bold styling */
table thead th {
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

/* DEC header columns with distinctive background */
table thead th.dec-header {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

/* Scrollbar styling for table container */
.overflow-auto::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.overflow-auto::-webkit-scrollbar-track {
    background: var(--theme-surface);
    border-radius: 4px;
}

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

.overflow-auto::-webkit-scrollbar-thumb:hover {
    background: var(--theme-primary);
}

/* Firefox scrollbar */
.overflow-auto {
    scrollbar-width: thin;
    scrollbar-color: var(--theme-border) var(--theme-surface);
}

/* Responsive grid düzeni */
@media (max-width: 768px) {
    .grid-container {
        max-width: 100%;
        gap: 2px;
    }
    
    .input-cell.ascii-cell { 
        width: 20px; 
        min-width: 20px;
        max-width: 20px;
        font-size: 0.75rem;
    }
    .input-cell.hex-cell { 
        width: 28px; 
        min-width: 28px;
        max-width: 28px;
        font-size: 0.75rem;
    }
    .input-cell.decimal-cell { 
        width: 36px; 
        min-width: 36px;
        max-width: 36px;
        font-size: 0.75rem;
    }
    .input-cell.binary-cell { 
        width: 80px; 
        min-width: 80px;
        max-width: 80px;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .grid-container {
        gap: 1px;
    }
    
    .input-cell.ascii-cell { 
        width: 18px; 
        min-width: 18px;
        max-width: 18px;
        font-size: 0.7rem;
    }
    .input-cell.hex-cell { 
        width: 24px; 
        min-width: 24px;
        max-width: 24px;
        font-size: 0.7rem;
    }
    .input-cell.decimal-cell { 
        width: 32px; 
        min-width: 32px;
        max-width: 32px;
        font-size: 0.7rem;
    }
    .input-cell.binary-cell { 
        width: 70px; 
        min-width: 70px;
        max-width: 70px;
        font-size: 0.65rem;
    }
}

/* CR and LF character highlighting */
.input-cell.cr-character {
    background-color: rgba(255, 193, 7, 0.2) !important;
    border: 2px solid #ffc107 !important;
    color: #ff8f00 !important;
    font-weight: bold !important;
}

.input-cell.lf-character {
    background-color: rgba(76, 175, 80, 0.2) !important;
    border: 2px solid #4caf50 !important;
    color: #2e7d32 !important;
    font-weight: bold !important;
}

.input-cell.crlf-character {
    background-color: rgba(156, 39, 176, 0.2) !important;
    border: 2px solid #9c27b0 !important;
    color: #6a1b9a !important;
    font-weight: bold !important;
}

/* Hex input specific highlighting */
.hex-cell.cr-character {
    background-color: rgba(255, 193, 7, 0.3) !important;
    border: 2px solid #ffc107 !important;
    color: #ff8f00 !important;
    font-weight: bold !important;
}

.hex-cell.lf-character {
    background-color: rgba(76, 175, 80, 0.3) !important;
    border: 2px solid #4caf50 !important;
    color: #2e7d32 !important;
    font-weight: bold !important;
}

/* Reference table CR/LF highlighting */
.table-cell.cr-character {
    background-color: rgba(255, 193, 7, 0.2) !important;
    border-color: #ffc107 !important;
    color: #ff8f00 !important;
}

.table-cell.lf-character {
    background-color: rgba(76, 175, 80, 0.2) !important;
    border-color: #4caf50 !important;
    color: #2e7d32 !important;
}
