:root {
    --color-primary: #5A9CB5;
    --color-secondary: #FACE68;
    --color-accent: #FAAC68;
    --color-highlight: #FA6868;
    --color-primary-rgb: 90, 156, 181;
    --color-secondary-rgb: 250, 206, 104;
    --color-accent-rgb: 250, 172, 104;
    --color-highlight-rgb: 250, 104, 104;
}

* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f6f8fc;
    color: #1f2a37;
}

.page-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 10% 10%, rgba(var(--color-primary-rgb), 0.16), transparent 40%),
        radial-gradient(circle at 90% 20%, rgba(var(--color-accent-rgb), 0.14), transparent 42%),
        linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
}

/* Color Widget Styles */
.color-widget {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.widget-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #333;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.widget-toggle:hover {
    transform: scale(1.05);
}

.widget-content {
    position: absolute;
    top: 60px;
    right: 0;
    width: 350px;
    max-height: 80vh;
    overflow-y: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    border: 1px solid #eee;
    font-family: sans-serif;
}

.widget-content.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Widget Header */
.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.widget-title {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.widget-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-close-btn:hover {
    color: #333;
}

/* Input Section */
.palette-input-section {
    margin-bottom: 15px;
}

.palette-input-section input {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
    box-sizing: border-box;
    font-size: 14px;
}

.palette-input-section input:focus {
    outline: none;
    border-color: #999;
}

.input-hint {
    font-size: 11px;
    color: #888;
    margin: 5px 0 0 0;
}

/* Palette List */
.palette-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.palette-card {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #eee;
    gap: 10px;
    cursor: pointer;
    background: white;
    transition: all 0.5s ease;
    position: relative;
}

.palette-card:hover {
    background: #f9f9f9;
    border-color: #ddd;
}

.palette-card.active {
    background: #e3f2fd !important;
    border-color: #2196f3 !important;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.palette-card.active::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #2196f3;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.palette-card.highlighted {
    background-color: #fff9c4 !important;
    border-color: #fbc02d !important;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(251, 192, 45, 0.3);
}

/* Palette Preview */
.palette-preview-container {
    display: flex;
    width: 80px;
    height: 30px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.palette-color-block {
    flex: 1;
    height: 100%;
}

/* Palette Info */
.palette-info {
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

.palette-id {
    font-size: 12px;
    font-weight: bold;
    display: block;
    color: #333;
}

.palette-card.active .palette-id {
    color: #2196f3;
}

.palette-codes {
    font-size: 10px;
    color: #666;
    font-family: monospace;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Delete Button */
.palette-delete-btn {
    background: none;
    border: none;
    color: #ff4d4d;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.palette-card:hover .palette-delete-btn {
    opacity: 1;
}

.palette-delete-btn:hover {
    color: #ff0000;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: #aaa;
    font-size: 13px;
    padding: 20px;
}

/* Palette Modal */
.palette-modal-status {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

.palette-modal-status.error {
    color: #d9534f;
}

.palette-modal-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.palette-modal-card {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.palette-modal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    border-color: #ddd;
}

.palette-modal-card.added {
    border-color: #198754;
    box-shadow: 0 2px 8px rgba(25, 135, 84, 0.2);
}

.palette-modal-card.added::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 10px;
    color: #198754;
    font-weight: bold;
}

.palette-modal-preview {
    display: flex;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.palette-modal-color {
    flex: 1;
}

.palette-modal-codes {
    font-size: 11px;
    color: #555;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.widget-spotlight {
    position: absolute;
    top: 88px;
    right: 86px;
    max-width: 320px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(var(--color-primary-rgb), 0.28);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
    z-index: 1100;
}

.widget-spotlight::after {
    content: '';
    position: absolute;
    top: -14px;
    right: 24px;
    width: 18px;
    height: 18px;
    border-left: 3px solid rgba(var(--color-primary-rgb), 0.75);
    border-top: 3px solid rgba(var(--color-primary-rgb), 0.75);
    transform: rotate(45deg);
}

.spotlight-title {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-primary);
}

.spotlight-subtitle {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #4b5563;
}

.hero-helper-card {
    max-width: 760px;
    margin-inline: auto;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    text-align: left;
}

.hero-helper-card p {
    font-size: 0.98rem;
    line-height: 1.5;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(130deg, var(--color-primary) 0%, var(--color-accent) 55%, var(--color-highlight) 100%);
    padding: 110px 0 90px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.25), transparent 35%);
    pointer-events: none;
}

/* Navigation */
.navbar {
    background: var(--color-primary) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

/* Section Titles */
section {
    position: relative;
}

section.py-5 {
    margin-block: 12px;
}

#components,
section.bg-light {
    background: linear-gradient(180deg, #ffffff 0%, #f2f6ff 100%) !important;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--color-primary);
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--color-highlight);
    border-radius: 2px;
}

/* Bootstrap Override - Primary Color */
.btn-primary,
.bg-primary,
.badge.bg-primary,
.list-group-item-primary,
.alert-primary {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

.btn-primary:hover {
    background-color: rgba(var(--color-primary-rgb), 0.85) !important;
    border-color: rgba(var(--color-primary-rgb), 0.85) !important;
}

.text-primary {
    color: var(--color-primary) !important;
}

/* Bootstrap Override - Secondary Color */
.btn-secondary,
.bg-secondary,
.badge.bg-secondary {
    background-color: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    color: #333 !important;
}

.btn-secondary:hover {
    background-color: rgba(var(--color-secondary-rgb), 0.85) !important;
    border-color: rgba(var(--color-secondary-rgb), 0.85) !important;
}

/* Bootstrap Override - Success Color */
.btn-success,
.bg-success,
.badge.bg-success,
.list-group-item-success,
.alert-success,
.progress-bar.bg-success {
    background-color: var(--color-accent) !important;
    border-color: var(--color-accent) !important;
    color: #333 !important;
}

/* Bootstrap Override - Danger Color */
.btn-danger,
.bg-danger,
.badge.bg-danger,
.list-group-item-danger,
.alert-danger {
    background-color: var(--color-highlight) !important;
    border-color: var(--color-highlight) !important;
}

/* Bootstrap Override - Warning Color */
.btn-warning,
.badge.bg-warning,
.list-group-item-warning,
.alert-warning,
.progress-bar.bg-warning {
    background-color: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    color: #333 !important;
}

/* Cards */
.card {
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.card.bg-primary {
    background-color: var(--color-primary) !important;
}

/* Links */
a {
    color: var(--color-primary);
}

a:hover {
    color: var(--color-accent);
}

/* Progress Bars */
.progress-bar {
    background-color: var(--color-primary) !important;
}

/* Spinners */
.spinner-border.text-primary,
.spinner-grow.text-primary {
    color: var(--color-primary) !important;
}

.spinner-border.text-success,
.spinner-grow.text-success {
    color: var(--color-accent) !important;
}

.spinner-border.text-danger,
.spinner-grow.text-danger {
    color: var(--color-highlight) !important;
}

.spinner-border.text-warning,
.spinner-grow.text-warning {
    color: var(--color-secondary) !important;
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--color-primary-rgb), 0.25);
}

.form-check-input:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

/* Footer */
.footer-section {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Scrollbar for widget */
.palette-list::-webkit-scrollbar {
    width: 6px;
}

.palette-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.palette-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;

.palette-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .color-widget {
        top: 10px;
        right: 10px;
    }
    
    .widget-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .widget-content {
        width: 300px;
    }

    .widget-spotlight {
        position: static;
        margin: 12px auto 0;
        max-width: calc(100% - 20px);
    }

    .widget-spotlight::after {
        display: none;
    }

    .hero-helper-card {
        text-align: center;
    }
}

#openPaletteModal:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
