/* Base Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.root-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-hint);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Selection */
::selection {
    background: var(--primary-light);
    color: white;
}

/* Focus outline */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    line-height: 1.3;
}

h1 {
    font-size: var(--font-size-3xl);
}

h2 {
    font-size: var(--font-size-2xl);
}

h3 {
    font-size: var(--font-size-xl);
}

h4 {
    font-size: var(--font-size-lg);
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-hint {
    color: var(--text-hint);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.font-mono {
    font-family: var(--font-mono);
}

.font-medium {
    font-weight: var(--font-weight-medium);
}

.font-semibold {
    font-weight: var(--font-weight-semibold);
}

.font-bold {
    font-weight: var(--font-weight-bold);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.gap-lg {
    gap: var(--spacing-lg);
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.p-sm {
    padding: var(--spacing-sm);
}

.p-md {
    padding: var(--spacing-md);
}

.p-lg {
    padding: var(--spacing-lg);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Animation keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-fadeIn {
    animation: fadeIn var(--transition-base);
}

.animate-slideUp {
    animation: slideUp var(--transition-base);
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

[data-theme="transparent-blue"] .card,
[data-theme="transparent-blue"] .sidebar,
[data-theme="transparent-blue"] .modal-content,
[data-theme="transparent-blue"] .status-bar,
[data-theme="transparent-blue"] .toast,
[data-theme="transparent-blue"] .editor-input,
[data-theme="transparent-blue"] .editor-output,
[data-theme="transparent-blue"] .titlebar {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ==================== Titlebar ==================== */
.titlebar {
    height: 32px;
    background: var(--bg-sidebar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.titlebar-drag {
    -webkit-app-region: drag;
    flex: 1;
    height: 100%;
}

.titlebar-logo {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--primary);
    padding-left: var(--spacing-md);
    display: flex;
    align-items: center;
    -webkit-app-region: drag;
}

.titlebar-controls {
    display: flex;
    height: 100%;
    -webkit-app-region: no-drag;
}

.titlebar-btn {
    width: 46px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.1s;
}

.titlebar-btn:hover {
    background: var(--bg-hover);
}

.titlebar-btn.btn-close:hover {
    background: var(--danger);
    color: white;
}

/* ==================== Interactive Feedback & Glow Effects ==================== */
.btn, .nav-item, .history-list-item, .card-select-item, .preset-card {
    transition: transform var(--transition-fast) ease, background var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
}

.btn:active, .nav-item:active, .history-list-item:active, .card-select-item:active {
    transform: scale(0.97);
}

.input, textarea, select {
    transition: border-color var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
}

.input:focus, textarea:focus, select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
    outline: none !important;
}

/* Optimize touch targets for phone views */
@media (max-width: 768px) {
    .btn {
        min-height: 38px;
    }
    .input, textarea, select {
        font-size: 16px !important; /* Prevents iOS auto-zoom on focus */
    }
}