@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Color Magic - Main Styles */
.color-magic-wrapper {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 2rem 0;
    padding: 0;
    line-height: 1.6;
}

.color-magic-container {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
}

/* Main gradient background */
.magic-gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.magic-gradient-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    border-radius: 24px;
    pointer-events: none;
}

/* Glass morphism effect */
.magic-glass {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Header styles */
.magic-header {
    text-align: center;
    margin-bottom: 2rem;
}

.magic-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin: 0 0 0.5rem 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.magic-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    font-weight: 400;
}

/* Color preview */
.magic-preview-section {
    margin-bottom: 2rem;
}

.magic-color-preview {
    width: 100%;
    height: 100px;
    border-radius: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.magic-color-preview::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.magic-color-preview:hover::after {
    left: 100%;
}

.magic-preview-label {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    font-weight: 500;
}

/* Palette buttons */
.magic-palette-controls {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.magic-palette-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.magic-palette-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Palette popups */
.magic-palette-popup {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 1rem;
    margin-top: 1rem;
    backdrop-filter: blur(15px);
    animation: slideDown 0.3s ease;
}

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

.magic-color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.magic-color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
}

.magic-color-swatch:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.magic-gradient-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.magic-gradient-swatch {
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.magic-gradient-swatch:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Input sections */
.magic-input-section {
    margin-bottom: 1.5rem;
}

.magic-input-label {
    display: block;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.magic-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.magic-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 0.75rem;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.magic-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.magic-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.magic-convert-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.magic-convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
}

.magic-convert-btn.green {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.magic-convert-btn.green:hover {
    box-shadow: 0 8px 25px rgba(17, 153, 142, 0.4);
}

/* RGB input specific styles */
.magic-rgb-inputs {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.magic-rgb-input {
    flex: 1;
    text-align: center;
    font-family: 'Courier New', monospace;
}

.magic-rgb-labels {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    justify-content: space-between;
}

.magic-rgb-label {
    flex: 1;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Results section */
.magic-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.magic-result-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.magic-result-item:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.magic-result-info h4 {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.magic-result-value {
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    margin: 0;
}

.magic-copy-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.magic-copy-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Footer */
.magic-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 107, 107);
    text-align: center;
}

.magic-footer-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin: 0;
}

.magic-footer-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.magic-footer-link:hover {
    color: white;
    text-decoration: underline;
}

/* Utility classes */
.magic-hidden {
    display: none !important;
}

.magic-mono {
    font-family: 'Courier New', monospace !important;
}

/* Toast notification */
.magic-toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(17, 153, 142, 0.3);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

.magic-toast.show {
    transform: translateX(0);
}

/* Responsive design */
@media (max-width: 768px) {
    .color-magic-container {
        max-width: 100%;
        margin: 0 1rem;
    }
    
    .magic-gradient-bg {
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    .magic-glass {
        padding: 1.25rem;
    }
    
    .magic-title {
        font-size: 1.75rem;
    }
    
    .magic-color-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
    
    .magic-color-swatch {
        width: 35px;
        height: 35px;
    }
    
    .magic-palette-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .magic-toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        transform: translateY(-120%);
    }
    
    .magic-toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .magic-gradient-bg {
        padding: 1rem;
        border-radius: 16px;
    }
    
    .magic-input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .magic-convert-btn {
        width: 100%;
    }
    
    .magic-rgb-inputs {
        gap: 0.25rem;
    }
}