/**
 * Bootstrap Color Generator - Estilos Customizados
 * Interface moderna e responsiva
 */

/* ============================================
   VARIÁVEIS GLOBAIS
   ============================================ */

:root {
    --app-transition: 0.3s ease;
    --app-border-radius: 0.5rem;
    --app-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --app-shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --app-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Dark mode adjustments */
[data-bs-theme="dark"] {
    --app-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
    --app-shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.4);
    --app-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.5);
}

/* ============================================
   RESET E BASE
   ============================================ */

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   HEADER / NAVBAR
   ============================================ */

.navbar {
    box-shadow: var(--app-shadow-sm);
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
}

.navbar-brand i {
    font-size: 1.5rem;
}

/* ============================================
   SIDEBAR
   ============================================ */

aside {
    min-height: calc(100vh - 56px);
    overflow-y: auto;
}

@media (max-width: 991.98px) {
    aside {
        min-height: auto;
        border-bottom: 1px solid var(--bs-border-color) !important;
    }
}

/* ============================================
   COLOR INPUT
   ============================================ */

.form-control-color {
    width: 3rem;
    height: 3rem;
    border-radius: var(--app-border-radius);
    cursor: pointer;
}

#colorInput {
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    font-weight: 600;
}

/* ============================================
   PRESET COLORS
   ============================================ */

.preset-color {
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid var(--bs-border-color);
    border-radius: var(--app-border-radius);
    cursor: pointer;
    transition: all var(--app-transition);
    padding: 0;
}

.preset-color:hover {
    transform: scale(1.1);
    box-shadow: var(--app-shadow-md);
    border-color: var(--bs-gray-700);
}

.preset-color:active {
    transform: scale(0.95);
}

/* ============================================
   COLOR SCALE
   ============================================ */

.color-scale {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0;
    border-radius: var(--app-border-radius);
    overflow: hidden;
    box-shadow: var(--app-shadow-md);
}

@media (max-width: 767.98px) {
    .color-scale {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .color-scale {
        grid-template-columns: repeat(5, 1fr);
    }
}

.color-swatch {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    padding: 1rem;
    min-height: 120px;
}

.color-swatch:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: var(--app-shadow-lg);
}

.color-swatch-info {
    text-align: center;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.color-swatch-shade {
    display: block;
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.color-swatch-hex {
    display: block;
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
    opacity: 0.9;
}

/* Efeito de clique */
.color-swatch:active {
    transform: scale(0.98);
}

/* ============================================
   COMPONENT PREVIEWS
   ============================================ */

.contrast-preview {
    border: 1px solid var(--bs-border-color);
    min-height: 80px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    transition: all var(--app-transition);
    font-weight: 500;
}

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

#toggleTheme {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#toggleTheme i {
    font-size: 1.125rem;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    border-radius: var(--app-border-radius);
    box-shadow: var(--app-shadow-sm);
    transition: all var(--app-transition);
}

.card:hover {
    box-shadow: var(--app-shadow-md);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    font-weight: 600;
    padding: 0.5em 0.75em;
}

/* ============================================
   FORMS
   ============================================ */

.form-label {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    border-radius: var(--app-border-radius);
    border-width: 1px;
}

/* ============================================
   TOAST
   ============================================ */

.toast {
    border-radius: var(--app-border-radius);
    box-shadow: var(--app-shadow-lg);
}

/* ============================================
   SCROLLBAR CUSTOMIZATION
   ============================================ */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-bg);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--bs-secondary) transparent;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

.color-swatch,
.card {
    animation: fadeIn 0.3s ease forwards;
}

/* Stagger animation for color swatches */
.color-swatch:nth-child(1) { animation-delay: 0s; }
.color-swatch:nth-child(2) { animation-delay: 0.05s; }
.color-swatch:nth-child(3) { animation-delay: 0.1s; }
.color-swatch:nth-child(4) { animation-delay: 0.15s; }
.color-swatch:nth-child(5) { animation-delay: 0.2s; }
.color-swatch:nth-child(6) { animation-delay: 0.25s; }
.color-swatch:nth-child(7) { animation-delay: 0.3s; }
.color-swatch:nth-child(8) { animation-delay: 0.35s; }
.color-swatch:nth-child(9) { animation-delay: 0.4s; }
.color-swatch:nth-child(10) { animation-delay: 0.45s; }

/* ============================================
   LOADING STATES
   ============================================ */

.spinner-border {
    width: 2rem;
    height: 2rem;
    border-width: 0.25em;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-shadow {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.hover-lift {
    transition: transform var(--app-transition);
}

.hover-lift:hover {
    transform: translateY(-2px);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 575.98px) {
    .navbar-brand {
        font-size: 1rem;
    }

    .navbar-brand i {
        font-size: 1.25rem;
    }

    .h5 {
        font-size: 1rem;
    }

    .color-swatch-shade {
        font-size: 1rem;
    }

    .color-swatch-hex {
        font-size: 0.75rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .navbar,
    aside,
    .btn,
    .toast-container {
        display: none !important;
    }

    .color-swatch {
        break-inside: avoid;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus visible para navegação por teclado */
.btn:focus-visible,
.form-control:focus-visible,
.preset-color:focus-visible,
.color-swatch:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Reduz movimento para usuários com preferência */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   DARK MODE SPECIFIC
   ============================================ */

[data-bs-theme="dark"] .color-swatch {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .color-swatch:hover {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), var(--app-shadow-lg);
}

[data-bs-theme="dark"] .preset-color {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .card {
    background-color: var(--bs-body-bg);
}

/* ============================================
   CUSTOM COMPONENT STYLES
   ============================================ */

/* Progress bar customizada */
.progress {
    border-radius: var(--app-border-radius);
    overflow: hidden;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* Form check customizado */
.form-check-input {
    cursor: pointer;
    border-width: 2px;
}

.form-check-label {
    cursor: pointer;
}

/* Alert icons */
.alert i {
    vertical-align: middle;
}

/* Card headers */
.card-header {
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

[data-bs-theme="dark"] .card-header {
    border-bottom-color: rgba(255, 255, 255, 0.125);
}

/* ============================================
   LAYOUT IMPROVEMENTS
   ============================================ */

main {
    background-color: var(--bs-body-bg);
}

section {
    background-color: var(--bs-body-bg);
}

/* Garante que o conteúdo não fique escondido atrás do navbar */
main {
    padding-top: 0;
}

/* Melhora o espaçamento em telas pequenas */
@media (max-width: 991.98px) {
    .p-3.p-md-4 {
        padding: 1rem !important;
    }
}

/* ============================================
   PERFORMANCE
   ============================================ */

/* GPU acceleration para animações */
.color-swatch,
.btn,
.preset-color,
.card {
    will-change: transform;
}

/* Remove will-change após a animação */
.color-swatch:hover,
.btn:hover,
.preset-color:hover {
    will-change: auto;
}
