/* Global Reset & Base Styles */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

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

/* Accessibility & Focus Styles */
textarea:focus,
button:focus,
input:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Animation Styles */
.tool-panel {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button Interaction Styles */
button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Textarea Styles */
textarea {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
}

button.loading {
    position: relative;
    color: transparent;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.copy-feedback {
    animation: copySuccess 0.3s ease-in-out;
}

@keyframes copySuccess {
    0% {
        background-color: #10b981;
        transform: scale(1);
    }

    50% {
        background-color: #059669;
        transform: scale(1.05);
    }

    100% {
        background-color: #6b7280;
        transform: scale(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .tool-panel .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .tool-panel h2 {
        font-size: 1.5rem;
    }

    nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    nav button {
        flex: 1;
        min-width: 80px;
    }
}

/* Dark Mode */
.dark {
    color-scheme: dark;
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Accessibility - High Contrast */
@media (prefers-contrast: high) {
    button {
        border: 2px solid currentColor;
    }

    textarea {
        border: 2px solid currentColor;
    }
}
