/*! © M.Nurlan | SAYN Tools Hub */

:root {
    --primary: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-bg-dark: rgba(17, 24, 39, 0.95);
    --animate: running;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    scroll-behavior: smooth;
    animation-play-state: var(--animate);
}

@keyframes fadeIn {
    0% { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideUp {
    0% { 
        transform: translateY(100%); 
    }
    100% { 
        transform: translateY(0); 
    }
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: .5; 
    }
}

.tool-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeIn 0.5s ease-out forwards;
    border-radius: 0.75rem;
    background: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dark .tool-card {
    background: #1f2937;
    border-color: #374151;
}

.dark .tool-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.watermark {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 10px;
    opacity: 0.6;
    pointer-events: none;
    z-index: 9999;
    font-weight: 500;
    color: #6b7280;
}

.dark .watermark {
    color: #9ca3af;
}

.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.dark .gradient-bg {
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
}

.glass-effect {
    backdrop-filter: blur(10px);
    background: var(--glass-bg);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
}

.dark .glass-effect {
    background: var(--glass-bg-dark);
    border-bottom: 1px solid rgba(55, 65, 81, 0.5);
}

.regex-highlight {
    background-color: rgba(253, 224, 71, 0.5);
    padding: 0.1em 0.2em;
    border-radius: 0.25em;
    font-weight: 500;
}

.dark .regex-highlight {
    background-color: rgba(161, 98, 7, 0.5);
    color: #fbbf24;
}

.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5em 1em;
    background: #374151;
    color: white;
    border-radius: 0.5em;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 10;
    pointer-events: none;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}

.dark .tooltip::after {
    background: #1f2937;
    border: 1px solid #374151;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.file-drop-zone {
    border: 2px dashed #d1d5db;
    transition: all 0.3s ease;
    background: #f9fafb;
    cursor: pointer;
}

.file-drop-zone:hover {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.05);
}

.file-drop-zone.active {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

.dark .file-drop-zone {
    border-color: #4b5563;
    background: #374151;
}

.dark .file-drop-zone:hover {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.dark .file-drop-zone.active {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.2);
}

#ipMap {
    height: 200px;
    width: 100%;
    border-radius: 0.5rem;
    overflow: hidden;
    z-index: 0;
}

.progress-container {
    width: 100%;
    height: 4px;
    background-color: #e5e7eb;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.dark .progress-container {
    background-color: #374151;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.filter-btn {
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.filter-btn:hover {
    transform: translateY(-1px);
}

.filter-btn.active {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
    border-color: #3b82f6;
}

.dark .filter-btn.active {
    background: #1e3a8a !important;
    color: #93c5fd !important;
}

.favorite-btn i {
    transition: all 0.3s ease;
}

.favorite-btn:hover i {
    transform: scale(1.2);
}

.favorite-btn i.fas {
    color: #ef4444 !important;
    animation: pulse 0.6s ease-in-out;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    ring: 2px;
    ring-color: #3b82f6;
    border-color: transparent;
}

button {
    transition: all 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#toast {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#settingsPanel {
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

@media (max-width: 768px) {
    .tool-card {
        padding: 1rem;
    }
    
    .tool-card h3 {
        font-size: 1rem;
    }
    
    .tool-card p {
        font-size: 0.875rem;
    }
    
    .grid.grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .flex.space-x-2 > * {
        flex: 1;
        min-width: 0;
    }
    
    .flex.space-x-2 > button {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    #settingsPanel {
        width: calc(100vw - 2rem);
        right: 1rem;
        left: 1rem;
    }
    
    .tooltip::after {
        font-size: 0.7rem;
        padding: 0.25em 0.5em;
    }
    
    .watermark {
        font-size: 9px;
        bottom: 5px;
        right: 5px;
    }
}

@media (max-width: 640px) {
    .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .tool-card {
        padding: 0.75rem;
    }
    
    .tool-card h3 {
        font-size: 0.9rem;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .space-x-3 > * + * {
        margin-left: 0.5rem;
    }
    
    input, textarea, select {
        font-size: 16px; 
    }
}

@media (max-width: 480px) {
    .px-4 {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .py-8 {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .space-y-4 > * + * {
        margin-top: 0.75rem;
    }
    
    .gap-6 {
        gap: 1rem;
    }
    
    #ipMap {
        height: 150px;
    }
}

@media (prefers-contrast: high) {
    .tool-card {
        border-width: 2px;
    }
    
    .tool-card:hover {
        border-color: var(--primary);
    }
    
    button {
        border: 2px solid currentColor;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .tool-card:hover {
        transform: none;
    }
    
    button:hover {
        transform: none;
    }
}

@media print {
    .watermark,
    nav,
    #settingsPanel,
    #toast,
    #scrollToTop,
    button {
        display: none !important;
    }
    
    .tool-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}
