/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #FFFBF5;
    color: #1E1B2E;
    line-height: 1.6;
    min-height: 100vh;
}
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* === Layout === */
.app {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    width: 260px;
    background: #FFFFFF;
    border-right: 1px solid #E8E5F0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid #E8E5F0;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-text {
    font-size: 1.1rem;
    color: #1E1B2E;
    letter-spacing: -0.3px;
}
.logo-text strong {
    color: #F97316;
}
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #5B5675;
    text-decoration: none;
    transition: all 0.15s ease;
}
.nav-item:hover {
    background: #FFF7ED;
    color: #F97316;
}
.nav-item.active {
    background: #FFEDD5;
    color: #F97316;
    font-weight: 600;
}
.nav-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.nav-divider {
    height: 1px;
    background: #E8E5F0;
    margin: 10px 14px;
}
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #E8E5F0;
}
.footer-text {
    font-size: 0.75rem;
    color: #9B95B0;
}

/* === Mobile Header === */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #FFFFFF;
    border-bottom: 1px solid #E8E5F0;
    padding: 0 16px;
    align-items: center;
    gap: 12px;
    z-index: 90;
}
.menu-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 4px;
}
.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: #1E1B2E;
    border-radius: 2px;
    transition: all 0.3s ease;
}
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 95;
}
.overlay.active {
    display: block;
}

/* === Main Content === */
.main {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    max-width: 900px;
}

/* === Tool Panels === */
.tool-panel {
    display: none;
    animation: fadeIn 0.25s ease;
}
.tool-panel.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.panel-header {
    margin-bottom: 28px;
}
.panel-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1E1B2E;
    margin-bottom: 6px;
}
.panel-desc {
    font-size: 0.95rem;
    color: #7A7490;
}

/* === Options Grid === */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}
.option-group label:not(.checkbox-label) {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #5B5675;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.option-group.full-width {
    grid-column: 1 / -1;
}
.checkbox-group {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #3D3856;
    cursor: pointer;
    user-select: none;
}
.checkbox-label input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #C4BFD6;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.checkbox-label input[type="checkbox"]:checked {
    background: #F97316;
    border-color: #F97316;
}
.checkbox-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* === Inputs === */
.input-sm, .input-select, .input-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #D8D4E8;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #1E1B2E;
    background: #FFFFFF;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-sm:focus, .input-select:focus, .input-textarea:focus {
    outline: none;
    border-color: #F97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}
/* === Custom Select === */
.custom-select {
    position: relative;
    width: 100%;
    user-select: none;
    z-index: 10;
}
.custom-select.open {
    z-index: 40;
}
.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1.5px solid #D8D4E8;
    border-radius: 10px;
    background: #FFFFFF;
    cursor: pointer;
    font-size: 0.9rem;
    color: #1E1B2E;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.custom-select-trigger:hover {
    border-color: #B8B2D0;
}
.custom-select.open .custom-select-trigger {
    border-color: #F97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}
.custom-select-trigger svg {
    color: #9B95B0;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.custom-select.open .custom-select-trigger svg {
    transform: rotate(180deg);
    color: #F97316;
}
.custom-select-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #FFFFFF;
    border: 1.5px solid #E8E5F0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(30, 27, 46, 0.1), 0 2px 8px rgba(30, 27, 46, 0.06);
    z-index: 50;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all 0.2s ease;
}
.custom-select.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.custom-select-option {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    color: #3D3856;
    transition: all 0.1s ease;
}
.custom-select-option:hover {
    background: #FFF7ED;
    color: #F97316;
}
.custom-select-option.selected {
    background: #FFEDD5;
    color: #F97316;
    font-weight: 600;
}
.input-textarea {
    resize: vertical;
    min-height: 80px;
}

/* === Range === */
.range-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.range-wrap input[type="range"] {
    flex: 1;
    appearance: none;
    height: 6px;
    background: #E8E5F0;
    border-radius: 3px;
    outline: none;
}
.range-wrap input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #F97316;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
}
.range-num {
    width: 60px !important;
    text-align: center;
    padding: 8px !important;
}

/* === Generate Button === */
.btn-generate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: #F97316;
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}
.btn-generate:hover {
    background: #EA580C;
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.35);
    transform: translateY(-1px);
}
.btn-generate:active {
    transform: translateY(0);
}
.btn-generate.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* === Result Area === */
.result-area {
    margin-top: 24px;
    min-height: 20px;
}
.result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #FFFFFF;
    border: 1.5px solid #E8E5F0;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: border-color 0.15s ease;
}
.result-item:hover {
    border-color: #C4BFD6;
}
.result-value {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.88rem;
    word-break: break-all;
    color: #1E1B2E;
    line-height: 1.5;
}
.result-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #F97316;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
    flex-shrink: 0;
}
.btn-copy {
    flex-shrink: 0;
    padding: 6px 14px;
    background: #FFF7ED;
    color: #F97316;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s ease;
}
.btn-copy:hover {
    background: #FFEDD5;
}
.btn-copy.copied {
    background: #DCFCE7;
    color: #16A34A;
}
.btn-copy-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #FFF7ED;
    color: #F97316;
    border: 1.5px solid #E8E5F0;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 12px;
    transition: all 0.15s ease;
}
.btn-copy-all:hover {
    background: #FFEDD5;
    border-color: #C4BFD6;
}

/* === Color Results === */
.color-result-area .color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.color-card {
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid #E8E5F0;
    background: #FFFFFF;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.color-card:hover {
    border-color: #C4BFD6;
    transform: translateY(-2px);
}
.color-preview {
    height: 80px;
    width: 100%;
}
.color-info {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.color-code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    color: #1E1B2E;
}
.color-copy {
    padding: 4px 10px;
    background: #FFF7ED;
    color: #F97316;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.color-copy:hover { background: #FFEDD5; }
.color-copy.copied { background: #DCFCE7; color: #16A34A; }

/* === Lorem Result === */
.lorem-text {
    padding: 20px;
    background: #FFFFFF;
    border: 1.5px solid #E8E5F0;
    border-radius: 12px;
    font-size: 0.92rem;
    line-height: 1.8;
    color: #3D3856;
    white-space: pre-wrap;
}
.lorem-text p {
    margin-bottom: 16px;
}
.lorem-text p:last-child {
    margin-bottom: 0;
}

/* === Hash Result === */
.hash-result-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: #FFFFFF;
    border: 1.5px solid #E8E5F0;
    border-radius: 10px;
    margin-bottom: 8px;
}
.hash-algo {
    font-size: 0.72rem;
    font-weight: 700;
    color: #F97316;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    background: #FFF7ED;
    border-radius: 6px;
    flex-shrink: 0;
    min-width: 70px;
    text-align: center;
}

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .mobile-header {
        display: flex;
    }
    .main {
        margin-left: 0;
        padding: 72px 16px 24px;
        max-width: 100%;
    }
    .options-grid {
        grid-template-columns: 1fr;
    }
    .panel-header h1 {
        font-size: 1.4rem;
    }
    .color-result-area .color-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (max-width: 480px) {
    .checkbox-group {
        flex-direction: column;
        gap: 10px;
    }
    .result-item {
        flex-wrap: wrap;
    }
    .result-value {
        width: 100%;
        font-size: 0.82rem;
    }
}

/* === Nav Section Label === */
.nav-section-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #9B95B0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 8px 14px 4px;
}

/* === Button Row === */
.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* === Outline Button === */
.btn-generate.btn-outline {
    background: #FFFFFF;
    color: #F97316;
    border: 1.5px solid #F97316;
    box-shadow: none;
}
.btn-generate.btn-outline:hover {
    background: #FFF7ED;
    box-shadow: none;
}

/* === Full Width Single === */
.full-width-single {
    margin-bottom: 18px;
}
.full-width-single label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #5B5675;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* === Identity Card === */
.identity-card {
    background: #FFFFFF;
    border: 1.5px solid #E8E5F0;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 12px;
}
.identity-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #FFF7ED;
    border-bottom: 1.5px solid #E8E5F0;
}
.identity-icon { font-size: 1.5rem; }
.identity-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1E1B2E;
}
.identity-details { padding: 12px 20px; }
.identity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #FFF7ED;
}
.identity-row:last-child { border-bottom: none; }
.identity-label {
    font-size: 0.82rem;
    color: #7A7490;
    min-width: 130px;
    flex-shrink: 0;
}
.identity-value {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.88rem;
    color: #1E1B2E;
    word-break: break-all;
}

/* === Gradient === */
.gradient-preview {
    height: 120px;
    border-radius: 14px;
    margin-bottom: 14px;
    border: 1.5px solid #E8E5F0;
    background: linear-gradient(to right, #F97316, #EC4899);
}
.gradient-code-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #1E1B2E;
    border-radius: 12px;
}
.gradient-code {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.88rem;
    color: #FB923C;
    word-break: break-all;
}
.gradient-code-wrap .btn-copy {
    background: rgba(249, 115, 22, 0.2);
    color: #FDBA74;
}
.gradient-code-wrap .btn-copy:hover {
    background: rgba(249, 115, 22, 0.3);
}
.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.color-input-wrap input[type="color"] {
    width: 40px;
    height: 40px;
    border: 1.5px solid #D8D4E8;
    border-radius: 10px;
    cursor: pointer;
    padding: 2px;
    background: #FFFFFF;
}
.color-hex-input {
    width: 100px !important;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 20px;
}
.stat-card {
    background: #FFFFFF;
    border: 1.5px solid #E8E5F0;
    border-radius: 12px;
    padding: 18px 16px;
    text-align: center;
    transition: border-color 0.15s ease;
}
.stat-card:hover { border-color: #C4BFD6; }
.stat-num {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #F97316;
    line-height: 1;
    margin-bottom: 6px;
}
.stat-label {
    font-size: 0.78rem;
    color: #7A7490;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === QR Code === */
.qr-code-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: #FFFFFF;
    border: 1.5px solid #E8E5F0;
    border-radius: 14px;
}
.qr-image {
    border-radius: 8px;
    image-rendering: pixelated;
}
.qr-actions { display: flex; gap: 10px; }

/* === Diff === */
.diff-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
}
.diff-side label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #5B5675;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.diff-output {
    background: #FFFFFF;
    border: 1.5px solid #E8E5F0;
    border-radius: 12px;
    overflow: hidden;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}
.diff-line {
    display: flex;
    align-items: flex-start;
    padding: 4px 14px;
    border-bottom: 1px solid #FFF7ED;
}
.diff-line:last-child { border-bottom: none; }
.diff-num {
    color: #9B95B0;
    min-width: 36px;
    text-align: right;
    padding-right: 12px;
    font-size: 0.78rem;
    line-height: 1.6;
    user-select: none;
}
.diff-text {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
}
.diff-equal { color: #3D3856; }
.diff-removed { background: #FEF2F2; color: #DC2626; }
.diff-added { background: #F0FDF4; color: #16A34A; }
.diff-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}
.diff-stat-added { color: #16A34A; font-weight: 600; }
.diff-stat-removed { color: #DC2626; font-weight: 600; }
.diff-stat-unchanged { color: #7A7490; }

/* === Timestamp Results === */
.ts-results .result-label {
    min-width: 90px;
}

@media (max-width: 768px) {
    .diff-inputs {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .identity-row {
        flex-wrap: wrap;
    }
    .identity-label {
        min-width: 100%;
    }
}
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .btn-row {
        flex-direction: column;
    }
    .btn-row .btn-generate {
        width: 100%;
        justify-content: center;
    }
}
