/* Web Tools - Custom Styles */

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Line clamp utilities */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Code editor styles */
.code-editor {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    tab-size: 4;
}

.code-editor:focus {
    outline: none;
}

/* Tool card hover effects */
.tool-card {
    transition: all 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-2px);
}

/* Textarea with line numbers */
.textarea-with-lines {
    position: relative;
}

.textarea-with-lines .line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    padding: 1rem;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    color: #94a3b8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    text-align: right;
    user-select: none;
    pointer-events: none;
}

/* Toast animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-enter {
    animation: slideIn 0.3s ease forwards;
}

.toast-exit {
    animation: slideOut 0.3s ease forwards;
}

/* Loading spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Copy button animation */
.copy-btn.copied {
    color: #22c55e !important;
}

.copy-btn.copied::after {
    content: 'Copied!';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

/* Syntax highlighting */
.syntax-string { color: #22c55e; }
.syntax-number { color: #f59e0b; }
.syntax-boolean { color: #8b5cf6; }
.syntax-null { color: #6b7280; }
.syntax-key { color: #3b82f6; }
.syntax-bracket { color: #64748b; }

/* JSON tree view */
.json-tree {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.json-tree .collapsible {
    cursor: pointer;
}

.json-tree .collapsible::before {
    content: '▼';
    display: inline-block;
    margin-right: 4px;
    transition: transform 0.2s;
}

.json-tree .collapsible.collapsed::before {
    transform: rotate(-90deg);
}

/* Input focus ring */
input:focus, textarea:focus, select:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Table styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.data-table tr:hover td {
    background: #f8fafc;
}

/* Password strength indicator */
.strength-bar {
    height: 4px;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.strength-very-weak { width: 20%; background: #ef4444; }
.strength-weak { width: 40%; background: #f97316; }
.strength-fair { width: 60%; background: #eab308; }
.strength-good { width: 80%; background: #22c55e; }
.strength-strong { width: 100%; background: #10b981; }

/* Range slider custom styling */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #2563eb;
}

/* Diff view styles */
.diff-line {
    padding: 2px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.diff-added {
    background: #dcfce7;
    color: #166534;
}

.diff-removed {
    background: #fee2e2;
    color: #991b1b;
}

.diff-unchanged {
    color: #6b7280;
}

/* Chart container */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* Regex match highlight */
.regex-match {
    background: #fef08a;
    border-radius: 2px;
    padding: 1px 2px;
}

/* File drop zone */
.drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
}

.drop-zone.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
}

/* Modal backdrop blur */
.modal-backdrop {
    backdrop-filter: blur(4px);
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-full {
        width: 100% !important;
        max-width: none !important;
    }
}

/* Dark mode support (if enabled) */
@media (prefers-color-scheme: dark) {
    .dark-mode-auto {
        --bg-primary: #1f2937;
        --bg-secondary: #374151;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease;
}

.animate-fadeInUp {
    animation: fadeInUp 0.4s ease;
}

/* Pomodoro timer styles */
.timer-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: conic-gradient(#3b82f6 var(--progress, 0%), #e2e8f0 var(--progress, 0%));
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-circle-inner {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   Mobile Optimizations
   ======================================== */

/* Improved touch targets for mobile */
@media (max-width: 640px) {
    /* Minimum touch target size */
    button, a, input[type="button"], input[type="submit"] {
        min-height: 44px;
    }
    
    /* Better spacing for mobile forms */
    input, textarea, select {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Compact code editor on mobile */
    .code-editor {
        font-size: 12px;
    }
    
    /* Smaller modals on mobile */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    /* Stack stats grid on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }
    
    /* Full width tables on mobile with horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better chart sizing on mobile */
    .chart-container {
        height: 300px;
    }
    
    /* Compact file upload zone on mobile */
    .drop-zone {
        padding: 24px 16px;
    }
    
    /* Smaller timer on mobile */
    .timer-circle {
        width: 160px;
        height: 160px;
    }
    
    .timer-circle-inner {
        width: 140px;
        height: 140px;
    }
    
    /* Optimize breadcrumbs for mobile */
    .breadcrumb {
        font-size: 0.875rem;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better tool headers on mobile */
    .tool-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    
    /* Compact tool icon on mobile */
    .tool-icon {
        width: 3rem !important;
        height: 3rem !important;
    }
    
    /* Stack button groups on mobile */
    .button-group {
        flex-direction: column;
        width: 100%;
    }
    
    .button-group button {
        width: 100%;
    }
}

/* Landscape phone optimization */
@media (max-width: 896px) and (orientation: landscape) {
    /* Reduce vertical padding in landscape */
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Compact navigation in landscape */
    nav {
        height: 3.5rem !important;
    }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Better grid layouts for tablets */
    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

/* Better text readability on mobile */
@media (max-width: 640px) {
    h1 { font-size: 1.75rem; line-height: 2rem; }
    h2 { font-size: 1.5rem; line-height: 1.75rem; }
    h3 { font-size: 1.25rem; line-height: 1.5rem; }
    h4 { font-size: 1.125rem; line-height: 1.5rem; }
    
    /* Better paragraph spacing on mobile */
    p {
        line-height: 1.6;
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Safe area insets for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Fix iOS Safari bounce effect */
body {
    overscroll-behavior-y: none;
}

/* Better active states for touch */
@media (hover: none) {
    a:active, button:active {
        opacity: 0.7;
    }
}
