* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    padding: 20px;
    color: #fff;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
}

.gradient-preview {
    height: 200px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
}

.gradient-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: center;
}

.controls {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
    font-size: 0.9rem;
}

select, input[type="range"] {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 1rem;
}

select option {
    background: #1a1a2e;
    color: #fff;
}

input[type="range"] {
    -webkit-appearance: none;
    height: 8px;
    padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.colors-section {
    margin-top: 25px;
}

.colors-section h3 {
    margin-bottom: 15px;
    color: #fff;
}

.color-stops {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.color-stop {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 8px;
}

.color-picker {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.position {
    width: 60px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 6px;
    text-align: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: #fff;
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-random {
    background: linear-gradient(90deg, #f093fb, #f5576c);
    color: #fff;
}

.btn-history {
    background: linear-gradient(90deg, #fa709a, #fee140);
    color: #1a1a2e;
}

.btn-save {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    color: #fff;
}

.btn-download {
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 8px 16px;
    margin-left: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.output-section {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.output-section h3 {
    margin-bottom: 15px;
    color: #fff;
}

.code-block {
    background: #0d1117;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.code-block code {
    color: #7ee787;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    word-break: break-all;
    flex: 1;
}

.code-actions {
    display: flex;
    gap: 8px;
}

.btn-copy {
    background: rgba(255,255,255,0.1);
    color: #fff;
    padding: 8px 16px;
    white-space: nowrap;
}

.btn-copy-scss {
    background: rgba(204, 102, 153, 0.3);
    color: #fff;
    padding: 8px 16px;
    white-space: nowrap;
}

.btn-copy-scss:hover {
    background: rgba(204, 102, 153, 0.5);
}

.btn-generate-class {
    background: rgba(102, 204, 153, 0.3);
    color: #fff;
    padding: 8px 16px;
    white-space: nowrap;
}

.btn-generate-class:hover {
    background: rgba(102, 204, 153, 0.5);
}

.presets {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 25px;
}

.presets h3 {
    margin-bottom: 20px;
    color: #fff;
    font-size: 1.3rem;
}

.preset-category {
    margin-bottom: 25px;
}

.preset-category:last-child {
    margin-bottom: 0;
}

.category-title {
    color: #aaa;
    font-size: 0.95rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.preset-item {
    height: 80px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.preset-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.3);
}

.preset-item:active {
    transform: translateY(-1px);
}

.preset-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.75rem;
    padding: 6px 8px;
    text-align: center;
    backdrop-filter: blur(4px);
}

.gradient-history {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.gradient-history h3 {
    margin-bottom: 20px;
    color: #fff;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: auto;
}

.btn-small:hover {
    background: rgba(255,100,100,0.3);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.history-item {
    height: 60px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.1);
}

.history-item:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.4);
}

.history-item-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    padding: 20px;
    font-style: italic;
}

.saved-gradients {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.saved-gradients h3 {
    margin-bottom: 20px;
    color: #fff;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.count-badge {
    background: #667eea;
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.saved-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.saved-item {
    height: 80px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.saved-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.3);
}

.saved-item:hover .delete-saved {
    opacity: 1;
}

.delete-saved {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: #ff4757;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.saved-item-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    padding: 40px;
    font-style: italic;
}

.remove-color {
    background: #ff4757;
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyboard-hint {
    text-align: center;
    color: #888;
    margin-top: 30px;
    font-size: 0.9rem;
}

.keyboard-hint strong {
    color: #aaa;
}

.keyboard-hint kbd {
    background: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #fff;
}

/* Shortcuts Modal Styles */
.shortcuts-content {
    max-width: 450px !important;
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    transition: background 0.2s;
}

.shortcut-item:hover {
    background: rgba(255,255,255,0.08);
}

.shortcut-item kbd {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.shortcut-item span {
    color: #ccc;
    font-size: 0.95rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #888;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #fff;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #fff;
}

.modal-content p {
    color: #888;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.modal-content pre {
    background: #0d1117;
    padding: 15px;
    border-radius: 8px;
    color: #7ee787;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    margin-bottom: 20px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0,0,0,0.9);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .code-block {
        flex-direction: column;
        align-items: stretch;
    }
    
    .code-block code {
        margin-bottom: 10px;
    }
    
    .category-grid, .saved-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }
    
    .preset-item, .saved-item {
        height: 70px;
    }
    
    .preset-name {
        font-size: 0.7rem;
        padding: 4px 6px;
    }
    
    .gradient-actions {
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 10px 18px;
    }
}
/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 100;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes gradientPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 15px 60px rgba(0,0,0,0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.btn-share {
    background: linear-gradient(90deg, #00c9ff, #92fe9d);
    color: #1a1a2e;
    padding: 8px 16px;
    white-space: nowrap;
}

.btn-share:hover {
    background: linear-gradient(90deg, #00b8eb, #7fe88a);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 201, 255, 0.4);
}

/* Light Theme Variables */
body.light-theme {
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
    color: #1a1a2e;
}

body.light-theme .subtitle {
    color: #666;
}

body.light-theme .controls,
body.light-theme .output-section,
body.light-theme .gradient-history,
body.light-theme .saved-gradients,
body.light-theme .presets {
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(0,0,0,0.1);
}

body.light-theme .control-group label {
    color: #444;
}

body.light-theme select,
body.light-theme input[type="range"] {
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.15);
    color: #1a1a2e;
}

body.light-theme select option {
    background: #fff;
    color: #1a1a2e;
}

body.light-theme input[type="range"]::-webkit-slider-thumb {
    background: #764ba2;
}

body.light-theme .theme-toggle {
    background: rgba(0,0,0,0.1);
    color: #1a1a2e;
}

body.light-theme .theme-toggle:hover {
    background: rgba(0,0,0,0.15);
}

body.light-theme code {
    background: #f0f0f0;
    color: #333;
}

body.light-theme .toast {
    background: rgba(0,0,0,0.8);
    color: #fff;
}

body.light-theme .btn-secondary {
    background: rgba(0,0,0,0.1);
    color: #1a1a2e;
}

body.light-theme .btn-secondary:hover {
    background: rgba(0,0,0,0.2);
}

body.light-theme .color-stop {
    background: rgba(0,0,0,0.05);
}

body.light-theme .history-item,
body.light-theme .saved-item,
body.light-theme .preset-item {
    border: 1px solid rgba(0,0,0,0.1);
}

body.light-theme .modal-content {
    background: #fff;
    color: #1a1a2e;
}

body.light-theme .keyboard-hint {
    background: rgba(0,0,0,0.05);
}

body.light-theme .keyboard-hint code {
    background: rgba(0,0,0,0.1);
    color: #1a1a2e;
}
