/**
 * Custom Styles for Cruise Price Tracker
 *
 * Note: Most styling is done via Tailwind CSS (CDN)
 * This file contains custom overrides and animations
 *
 * Brand colors are defined in includes/config.php - keep these in sync:
 * - BRAND_COLOR_PRIMARY: #0066b2 (cruise-blue)
 * - BRAND_COLOR_DARK: #003d6b (cruise-dark)
 * - BRAND_COLOR_LIGHT: #e6f2ff (cruise-light)
 */

:root {
    --cruise-blue: #0066b2;
    --cruise-dark: #003d6b;
    --cruise-light: #e6f2ff;
}

/* Pointer cursor on all buttons */
button, [type="button"], [type="submit"], [type="reset"] {
    cursor: pointer;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Smooth transitions */
* {
    scroll-behavior: smooth;
}

/* Cruise card hover effects */
.cruise-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cruise-card:hover {
    transform: translateY(-4px);
}

/* Filter sidebar sticky behavior */
@media (min-width: 1024px) {
    .sticky {
        position: sticky;
        top: 1rem;
    }
}

/* Price trend animations */
.price-drop {
    animation: priceDropPulse 2s ease-in-out;
}

@keyframes priceDropPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Loading spinner */
.animate-spin {
    animation: spin 1s linear infinite;
}

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

/* Fade in animation for cruise cards */
.cruise-card {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chart container */
#priceChart {
    max-height: 320px;
    max-width: 100%;
}

/* Ensure chart canvas doesn't overflow */
canvas {
    max-width: 100% !important;
}

/* Filter checkbox styling */
input[type="checkbox"] {
    cursor: pointer;
}

input[type="checkbox"]:checked {
    background-color: var(--cruise-blue);
    border-color: var(--cruise-blue);
}

/* Form inputs focus state */
input:focus,
select:focus {
    outline: none;
    border-color: var(--cruise-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 178, 0.1);
}

/* Button hover states */
button:not(:disabled):hover {
    transform: translateY(-1px);
}

button:disabled {
    cursor: not-allowed;
}

/* Navigation active state */
nav a.active {
    font-weight: 700;
    border-bottom: 2px solid white;
}

/* Empty state */
#emptyState svg {
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Price badge pulse for new drops */
.price-badge-new {
    animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

/* Hide scrollbar utility class for horizontal scrollable areas */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cruise-card:hover {
        transform: none;
    }

    #priceChart {
        max-height: 250px;
    }
}

/* Print styles */
@media print {
    nav,
    footer,
    #filterForm,
    #pagination,
    button {
        display: none !important;
    }

    .cruise-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cruise-card {
        border: 2px solid #000;
    }

    .text-gray-500 {
        color: #333;
    }
}

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

/* Admin page body background */
.admin-body {
    background-color: #dedede;
}

/* Calendar date picker 7-column grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

/* Admin modal layout */
.admin-modal-container {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.admin-modal-header {
    flex-shrink: 0;
}

.admin-modal-body {
    overflow-y: auto;
}

/* Admin scrollable list */
.admin-scrollable-list {
    max-height: 300px;
    overflow-y: auto;
}

/* Admin iframe preview */
.admin-iframe-preview {
    min-height: 500px;
}

/* Debug cruise output */
.debug-pre {
    font-family: monospace;
    font-size: 12px;
    background: #1a1a1a;
    color: #fff;
    padding: 20px;
    white-space: pre-wrap;
}

/* Article prose typography (replaces Tailwind Typography plugin) */
.prose {
    line-height: 1.75;
    color: #374151;
}

.prose h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #111827;
    margin-top: 0;
    margin-bottom: 1.25rem;
    line-height: 1.2;
}

.prose h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.3;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

.prose h2:first-of-type {
    margin-top: 2rem;
    border-top: none;
    padding-top: 0;
}

.prose h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.prose p {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

.prose ul, .prose ol {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    padding-left: 1.75rem;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose li {
    margin-bottom: 0.625rem;
    padding-left: 0.25rem;
}

.prose li strong {
    color: #111827;
}

.prose a {
    color: var(--cruise-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose a:hover {
    color: var(--cruise-dark);
}

.prose strong {
    font-weight: 600;
    color: #111827;
}

.prose blockquote {
    border-left: 4px solid var(--cruise-blue);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #4b5563;
    font-style: italic;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.prose table th {
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e5e7eb;
    color: #374151;
}

.prose table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.prose img {
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}

@media (max-width: 640px) {
    .prose h1 {
        font-size: 1.625rem;
    }

    .prose h2 {
        font-size: 1.3rem;
        margin-top: 2rem;
    }
}

/* Dark mode support (optional future enhancement) */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    body {
        background-color: #1a1a2e;
        color: #eee;
    }

    .bg-white {
        background-color: #16213e;
    }

    .text-gray-800 {
        color: #eee;
    }

    .text-gray-600,
    .text-gray-500 {
        color: #aaa;
    }
    */
}
