/* app/css/youtube-money-calculator.css */
/* YouTube Money Calculator - Complete Stylesheet */

/* ==========================================================================
   BASE STYLES & RESETS
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

/* Custom CSS Variables */
:root {
    --youtube-primary: #dc2626;        /* Red-600 */
    --youtube-primary-dark: #b91c1c;   /* Red-700 */
    --youtube-primary-light: #ef4444;  /* Red-500 */
    --youtube-secondary: #3b82f6;      /* Blue-500 */
    --youtube-success: #10b981;        /* Green-500 */
    --youtube-warning: #f59e0b;        /* Yellow-500 */
    --youtube-info: #8b5cf6;           /* Purple-500 */
    --youtube-gray-50: #f9fafb;
    --youtube-gray-100: #f3f4f6;
    --youtube-gray-200: #e5e7eb;
    --youtube-gray-300: #d1d5db;
    --youtube-gray-400: #9ca3af;
    --youtube-gray-500: #6b7280;
    --youtube-gray-600: #4b5563;
    --youtube-gray-700: #374151;
    --youtube-gray-800: #1f2937;
    --youtube-gray-900: #111827;
    --youtube-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --youtube-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --youtube-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --youtube-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --youtube-radius-sm: 0.125rem;
    --youtube-radius: 0.375rem;
    --youtube-radius-md: 0.5rem;
    --youtube-radius-lg: 0.75rem;
    --youtube-radius-xl: 1rem;
    --youtube-transition: all 0.2s ease-in-out;
}

/* ==========================================================================
   INPUT FIELD STYLES
   ========================================================================== */

.youtube-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--youtube-gray-300);
    border-radius: var(--youtube-radius-lg);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--youtube-gray-800);
    background-color: white;
    transition: var(--youtube-transition);
    outline: none;
}

.youtube-input:focus {
    border-color: var(--youtube-primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.youtube-input:hover:not(:focus) {
    border-color: var(--youtube-gray-400);
}

/* Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 0.5rem;
    background: linear-gradient(to right, var(--youtube-primary-light), var(--youtube-primary));
    border-radius: 9999px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    background-color: white;
    border: 2px solid var(--youtube-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--youtube-shadow);
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Buttons */
#viewPresets button {
    transition: all 0.2s;
}

#viewPresets button:hover {
    background-color: #e5e7eb !important;
    transform: translateY(-1px);
}

/* View Presets */
#viewPresets {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Checkbox Styles */
input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--youtube-primary);
}

/* ==========================================================================
   BUTTON STYLES
   ========================================================================== */

/* Primary Action Button */
button[onclick="calculateYouTubeEarnings()"] {
    width: 100%;
    padding: 1.25rem 2rem;
    border: none;
    border-radius: var(--youtube-radius-xl);
    font-weight: 700;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, var(--youtube-primary), var(--youtube-primary-dark));
    color: white;
    box-shadow: var(--youtube-shadow-lg);
    position: relative;
    overflow: hidden;
}

button[onclick="calculateYouTubeEarnings()"]:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    background: linear-gradient(135deg, var(--youtube-primary-dark), #991b1b);
}

button[onclick="calculateYouTubeEarnings()"]:active {
    transform: translateY(-1px) scale(0.99);
}

button[onclick="calculateYouTubeEarnings()"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button[onclick="calculateYouTubeEarnings()"]:active::after {
    width: 300px;
    height: 300px;
}

/* Toggle Buttons */
#earningsBreakdown button,
#growthProjection button {
    transition: all 0.3s ease;
}

#earningsBreakdown button:hover,
#growthProjection button:hover {
    background-color: var(--youtube-gray-200);
    transform: translateY(-1px);
}

/* Example Buttons */
.w-full.text-left.p-3 {
    transition: all 0.3s ease;
    border: 1px solid var(--youtube-gray-200);
    border-radius: var(--youtube-radius-lg);
    background-color: white;
}

.w-full.text-left.p-3:hover {
    background-color: #fef2f2;
    transform: translateX(4px);
    border-color: var(--youtube-primary-light);
    box-shadow: var(--youtube-shadow);
}

/* ==========================================================================
   COLORED BACKGROUND BOXES
   ========================================================================== */

.bg-red-50 { background-color: #fef2f2; }
.border-red-200 { border-color: #fecaca; }

.bg-blue-50 { background-color: #eff6ff; }
.border-blue-200 { border-color: #bfdbfe; }

.bg-green-50 { background-color: #f0fdf4; }
.border-green-200 { border-color: #bbf7d0; }

.bg-purple-50 { background-color: #faf5ff; }
.border-purple-200 { border-color: #e9d5ff; }

.bg-yellow-50 { background-color: #fefce8; }
.border-yellow-200 { border-color: #fef08a; }

.bg-orange-50 { background-color: #fff7ed; }
.border-orange-200 { border-color: #fed7aa; }

.bg-gray-50 { background-color: #f9fafb; }
.border-gray-200 { border-color: #e5e7eb; }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#resultContainer > div {
    animation: fadeIn 0.5s ease-out forwards;
}

.fab.fa-youtube {
    animation: pulse 2s infinite;
}

/* ==========================================================================
   TABLE STYLES
   ========================================================================== */

table.min-w-full {
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table.min-w-full thead th {
    background-color: var(--youtube-gray-50);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.875rem 1rem;
    border-bottom: 2px solid var(--youtube-gray-200);
}

table.min-w-full tbody tr {
    transition: background-color 0.2s ease;
}

table.min-w-full tbody tr:hover {
    background-color: var(--youtube-gray-50);
}

table.min-w-full tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--youtube-gray-200);
}

/* ==========================================================================
   CUSTOM SCROLLBAR
   ========================================================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--youtube-gray-100);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--youtube-primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--youtube-primary-dark);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
    
    .gap-8 {
        gap: 1.5rem !important;
    }
    
    .p-6 {
        padding: 1rem !important;
    }
    
    .text-6xl {
        font-size: 3rem !important;
    }
    
    table.min-w-full {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    #viewPresets {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
    
    .space-y-6 > * + * {
        margin-top: 1rem !important;
    }
    
    button[onclick="calculateYouTubeEarnings()"] {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--youtube-gray-900);
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--youtube-primary), #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 2rem;
    position: relative;
    padding-bottom: 0.5rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 3rem;
    height: 0.25rem;
    background: linear-gradient(90deg, var(--youtube-primary), transparent);
    border-radius: 2px;
}

/* RPM Highlight */
#nicheRPM {
    font-size: 1.1rem;
    transition: all 0.3s;
}

/* ==========================================================================
   EARNINGS DISPLAY
   ========================================================================== */

.text-red-700 {
    color: #b91c1c !important;
}

.text-green-600 {
    color: #059669 !important;
}

.text-blue-600 {
    color: #2563eb !important;
}

.text-purple-600 {
    color: #7c3aed !important;
}

.text-yellow-600 {
    color: #d97706 !important;
}

/* Benchmark styling */
.bg-blue-50 .font-bold.text-blue-700 {
    font-size: 1.1rem;
}

/* ==========================================================================
   PROGRESS BARS FOR RPM COMPARISON
   ========================================================================== */

.bg-gray-200.rounded-full {
    overflow: hidden;
    background-color: #e5e7eb;
}

.bg-red-600.rounded-full,
.bg-orange-600.rounded-full,
.bg-green-600.rounded-full,
.bg-yellow-600.rounded-full,
.bg-purple-600.rounded-full,
.bg-gray-600.rounded-full {
    transition: width 0.5s ease;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .no-print {
        display: none !important;
    }
    
    .bg-gradient-to-b {
        background: white !important;
    }
    
    .shadow-lg, .shadow-md, .shadow {
        box-shadow: none !important;
    }
    
    button, .flow-type-btn, .period-btn {
        display: none !important;
    }
    
    input, select, textarea {
        border: 1px solid #000 !important;
        background: none !important;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.youtube-input:focus-visible,
button:focus-visible {
    outline: 3px solid var(--youtube-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   ADDITIONAL STYLES
   ========================================================================== */

/* Tooltip styling */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background-color: var(--youtube-gray-900);
    color: white;
    font-size: 0.75rem;
    border-radius: var(--youtube-radius);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 50;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
}

/* Revenue badge animation */
@keyframes revenuePop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.text-6xl.font-bold {
    transition: all 0.3s;
}

.text-6xl.font-bold:hover {
    animation: revenuePop 0.5s ease;
}

/* Gradient background */
.bg-gradient-to-r.from-red-50.to-orange-50 {
    background: linear-gradient(90deg, #fef2f2 0%, #fff7ed 100%);
}

.bg-gradient-to-b.from-red-50.to-white {
    background: linear-gradient(180deg, #fef2f2 0%, white 100%);
}

/* Icon hover effects */
.bg-gray-50 .fab,
.bg-gray-50 .fas {
    transition: transform 0.3s ease;
}

.bg-gray-50:hover .fab,
.bg-gray-50:hover .fas {
    transform: scale(1.2);
}

/* Selection color */
::selection {
    background-color: rgba(220, 38, 38, 0.2);
    color: var(--youtube-gray-900);
}