/* 
 * Main Stylesheet for OSRS Companion
 * Complements Tailwind CSS with custom styles
 */

/* === Global Resets & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
    width: 12px;
}

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

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

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

/* Light mode scrollbar */
html:not(.dark) ::-webkit-scrollbar-track {
    background: #f3f4f6;
}

html:not(.dark) ::-webkit-scrollbar-thumb {
    background: #d1d5db;
}

html:not(.dark) ::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* === Smooth Transitions === */
* {
    transition: background-color 0.2s ease, 
                color 0.2s ease, 
                border-color 0.2s ease,
                opacity 0.2s ease;
}

/* === Focus Styles === */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
}

/* === Animation === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-down {
    animation: slideDown 0.3s ease-out;
}

/* === Custom Utilities === */
.shadow-glow {
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.3);
}

.shadow-glow-dark {
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.5);
}

/* === Button Enhancements === */
button,
.btn {
    cursor: pointer;
    user-select: none;
}

button:active,
.btn:active {
    transform: scale(0.98);
}

/* === Form Improvements === */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* === Loading State === */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* === Mobile Optimizations === */
@media (max-width: 768px) {
    body {
        font-size: 16px; /* Prevent zoom on input focus */
    }
}

/* === Print Styles === */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    nav,
    footer,
    .no-print {
        display: none !important;
    }
}

/* === Accessibility === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* === OSRS Theme Colors === */
.bg-osrs-yellow {
    background-color: #FFD700;
}

.bg-osrs-orange {
    background-color: #FF8C00;
}

.bg-osrs-brown {
    background-color: #8B4513;
}

.bg-osrs-green {
    background-color: #228B22;
}

.text-osrs-yellow {
    color: #FFD700;
}

.text-osrs-orange {
    color: #FF8C00;
}

.text-osrs-brown {
    color: #8B4513;
}

.text-osrs-green {
    color: #228B22;
}

/* === Card Hover Effects === */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.dark .card-hover:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* === Flash Message Animation === */
.flash-message {
    animation: slideDown 0.3s ease-out;
}

/* === Dropdown Animation === */
.dropdown-enter {
    animation: fadeIn 0.2s ease-out;
}

/* === Progress Bar === */
.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.dark .progress-bar {
    background: #374151;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #eab308, #f59e0b);
    transition: width 0.3s ease;
}

/* === Skeleton Loading === */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* === Tooltip === */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 4px 8px;
    background: #1f2937;
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.tooltip:hover::before {
    opacity: 1;
}

/* === Badge === */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success {
    background: #10b981;
    color: white;
}

.badge-error {
    background: #ef4444;
    color: white;
}

.badge-warning {
    background: #f59e0b;
    color: white;
}

.badge-info {
    background: #3b82f6;
    color: white;
}

/* === Custom Grid === */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* === Z-Index Layers === */
.z-dropdown {
    z-index: 50;
}

.z-modal {
    z-index: 100;
}

.z-toast {
    z-index: 150;
}
