/* CryptoBox Custom Styles */

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #161b22;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* Sidebar */
.nav-category {
    margin-bottom: 0.25rem;
}

.nav-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8b949e;
    transition: background-color 0.15s;
}

.nav-category-header:hover {
    background-color: #21262d;
}

.nav-category-header .arrow {
    transition: transform 0.2s;
    font-size: 0.625rem;
}

.nav-category-header.collapsed .arrow {
    transform: rotate(-90deg);
}

.nav-category-items {
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.nav-category-items.collapsed {
    max-height: 0 !important;
}

.nav-item {
    display: block;
    padding: 0.375rem 0.75rem 0.375rem 1.5rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: #c9d1d9;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item:hover {
    background-color: #21262d;
    color: #f0f6fc;
}

.nav-item.active {
    background-color: rgba(0, 210, 211, 0.1);
    color: #00d2d3;
    border-left: 2px solid #00d2d3;
}

/* Textarea */
textarea {
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    line-height: 1.6;
}

textarea:focus {
    box-shadow: 0 0 0 1px rgba(0, 210, 211, 0.3);
}

/* Checkbox custom */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid #30363d;
    border-radius: 3px;
    background: #1c2128;
    cursor: pointer;
    position: relative;
}

input[type="checkbox"]:checked {
    background: #00d2d3;
    border-color: #00d2d3;
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: -1px;
    left: 1px;
    font-size: 11px;
    color: #0d1117;
    font-weight: bold;
}

/* Select custom */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.5rem;
}

/* Toast animation */
.toast-show {
    transform: translateY(0) !important;
    opacity: 1 !important;
}

/* Key/IV full-width row */
.key-iv-row {
    border-top: 1px solid #21262d;
    padding-top: 0.75rem;
}

.key-iv-row input[type="text"] {
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

/* Tool options grid */
.tool-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.option-group label {
    font-size: 0.75rem;
    color: #8b949e;
}

.option-group select,
.option-group input[type="text"],
.option-group input[type="number"] {
    background: #1c2128;
    border: 1px solid #30363d;
    border-radius: 0.375rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    color: #c9d1d9;
    width: 100%;
}

.option-group select:focus,
.option-group input:focus {
    outline: none;
    border-color: #00d2d3;
}

/* Key length indicator */
.key-length-hint {
    font-size: 0.6875rem;
    color: #8b949e;
    margin-top: 0.125rem;
}

.key-length-hint.error {
    color: #f85149;
}

.key-length-hint.ok {
    color: #3fb950;
}

/* Output message styles */
.output-msg-error {
    color: #f85149;
}

.output-msg-success {
    color: #3fb950;
}

.output-msg-info {
    color: #58a6ff;
}

/* Mobile sidebar overlay */
@media (max-width: 1023px) {
    #sidebar.open {
        display: block;
        position: fixed;
        top: 53px;
        left: 0;
        bottom: 0;
        z-index: 40;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        top: 53px;
        background: rgba(0, 0, 0, 0.5);
        z-index: 30;
    }
}

/* Search highlight */
.search-highlight {
    background: rgba(0, 210, 211, 0.2);
    border-radius: 2px;
}

/* History panel */
#history-panel.open {
    display: flex !important;
}

.history-card {
    background: #1c2128;
    border: 1px solid #30363d;
    border-radius: 0.5rem;
    padding: 0.625rem;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.history-card:hover {
    border-color: #00d2d3;
    background: #21262d;
}

.history-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.375rem;
}

.history-card-tool {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #00d2d3;
    background: rgba(0, 210, 211, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.history-card-time {
    font-size: 0.625rem;
    color: #6e7681;
}

.history-card-action {
    font-size: 0.625rem;
    color: #8b949e;
    background: #21262d;
    padding: 0.0625rem 0.25rem;
    border-radius: 0.125rem;
}

.history-card-content {
    font-size: 0.6875rem;
    color: #8b949e;
    line-height: 1.4;
    word-break: break-all;
}

.history-card-content .label {
    color: #6e7681;
    margin-right: 0.25rem;
}

.history-card-content .value {
    color: #c9d1d9;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.history-card-key {
    font-size: 0.625rem;
    color: #6e7681;
    margin-top: 0.25rem;
    font-family: monospace;
}

.history-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.375rem;
    padding-top: 0.375rem;
    border-top: 1px solid #21262d;
}

.history-card-actions button {
    font-size: 0.625rem;
    color: #8b949e;
    transition: color 0.15s;
}

.history-card-actions button:hover {
    color: #00d2d3;
}

.history-card-actions button.delete:hover {
    color: #f85149;
}

/* History panel responsive */
@media (max-width: 1279px) {
    #history-panel.open {
        position: fixed;
        top: 53px;
        right: 0;
        bottom: 0;
        z-index: 40;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.5);
    }
}

/* Responsive textarea */
@media (max-width: 640px) {
    textarea {
        font-size: 13px;
    }
}
