/* ===== BEAUTIFULLY CRAFTED BUTTONS & ICONS ===== */
/* Mathematical proportions, artistic precision, perfect interactions */

/* Golden Ratio: 1.618 */
/* Perfect Scale: 1, 1.25, 1.618, 2.618 */

:root {
    /* Primary Colors */
    --primary-500: #667eea;
    --primary-600: #5568d3;
    --primary-700: #4559b8;

    /* Secondary Colors */
    --secondary-500: #764ba2;
    --secondary-600: #6a3d8f;

    /* Accent Colors */
    --accent-cyan: #00d4ff;
    --accent-pink: #ff006e;
    --accent-gold: #ffd700;

    /* Neutrals */
    --neutral-50: #f9fafb;
    --neutral-100: #f3f4f6;
    --neutral-200: #e5e7eb;
    --neutral-300: #d1d5db;
    --neutral-400: #9ca3af;
    --neutral-500: #6b7280;
    --neutral-600: #4b5563;
    --neutral-700: #374151;
    --neutral-900: #111827;

    /* Shadows - Physical Depth */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Transitions - Easing Functions */
    --ease-in-out-cubic: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== BUTTON BASE STYLES ===== */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    /* Golden ratio proportions */
    padding: 0.75rem 1.618rem;
    border-radius: 0.618rem;

    /* Typography */
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-decoration: none;
    text-transform: uppercase;

    /* Interactions */
    border: none;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s var(--ease-in-out-cubic);

    /* Physical appearance */
    box-shadow: var(--shadow-md);
    transform: translateZ(0);
    will-change: transform, box-shadow;
}

/* Hover state - Subtle lift */
.btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: var(--shadow-md);
    opacity: 0.95;
}

/* Active state - Press down with evaporation */
.btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-sm);
}

/* Focus state - Accessibility */
.btn:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Disabled state */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== PRIMARY BUTTON ===== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

/* Primary shimmer effect */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--secondary-600) 100%);
    box-shadow: 0 10px 25px -5px rgba(102, 126, 234, 0.4);
}

/* ===== SECONDARY BUTTON ===== */
.btn-secondary {
    background: white;
    color: var(--primary-600);
    border: 2px solid var(--primary-500);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--primary-50), var(--secondary-50));
    border-color: var(--primary-600);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.25);
}

/* ===== SUCCESS BUTTON ===== */
.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
}

/* ===== DANGER BUTTON ===== */
.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.4);
}

/* ===== SIZE VARIANTS ===== */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-xl {
    padding: 1.25rem 2.5rem;
    font-size: 1.25rem;
    letter-spacing: 1px;
}

/* ===== ICON BUTTONS ===== */
.btn-icon {
    width: 2.618rem;
    height: 2.618rem;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.btn-icon-sm {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
}

.btn-icon-lg {
    width: 3.618rem;
    height: 3.618rem;
    font-size: 1.5rem;
}

/* ===== BUTTON GROUPS ===== */
.btn-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.btn-group-vertical {
    flex-direction: column;
}

/* ===== ICONS (Emoji-based with styling) ===== */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.618rem;
    height: 1.618rem;
    font-size: 1rem;
    transition: transform 0.3s var(--ease-in-out-cubic);
}

.icon-spin {
    animation: spin 1s linear infinite;
}

.icon-pulse {
    animation: pulse 2s var(--ease-in-out-cubic) infinite;
}

.icon-bounce {
    animation: bounce 0.6s var(--ease-out-expo) infinite;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

/* ===== BUTTON WITH ICON LAYOUT ===== */
.btn .icon {
    margin-right: 0.25rem;
}

.btn .icon-right {
    order: 2;
    margin-right: 0;
    margin-left: 0.25rem;
}

/* ===== LOADING STATE ===== */
.btn-loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-loading .icon-spin {
    display: inline-flex;
}

/* ===== GRADIENT BACKGROUNDS FOR BUTTONS ===== */
.gradient-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 100%);
}

.gradient-cyan {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--primary-500) 100%);
}

.gradient-warm {
    background: linear-gradient(135deg, #ff6b6b 0%, var(--accent-gold) 100%);
}

/* ===== BUTTON TEXT STYLES ===== */
.btn-text {
    background: transparent;
    box-shadow: none;
    padding: 0.5rem 0.75rem;
    color: var(--primary-600);
}

.btn-text:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-700);
}

/* ===== LINK BUTTONS ===== */
.btn-link {
    background: transparent;
    color: var(--primary-600);
    text-decoration: underline;
    text-transform: none;
    box-shadow: none;
    padding: 0;
    font-weight: normal;
}

.btn-link:hover {
    color: var(--primary-700);
    box-shadow: none;
    transform: none;
}

/* ===== TOGGLE BUTTONS ===== */
.btn-toggle {
    background: var(--neutral-200);
    color: var(--neutral-700);
}

.btn-toggle.active {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 100%);
    color: white;
}

/* ===== TOOLTIP FOR BUTTONS ===== */
.btn[data-tooltip] {
    position: relative;
}

.btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: var(--neutral-900);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s var(--ease-in-out-cubic);
    z-index: 1000;
}

.btn[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== RESPONSIVE BUTTONS ===== */
@media (max-width: 640px) {
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .btn-group {
        gap: 0.5rem;
    }

    .btn-group-vertical {
        width: 100%;
    }

    .btn-group-vertical .btn {
        width: 100%;
    }
}

/* ===== PARTICLE EVAPORATION EFFECT ===== */
@keyframes evaporate {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

@keyframes particle-float {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) rotate(var(--rot));
    }
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    opacity: 0;
    border-radius: 50%;
    transform: scale(0);
    transform-origin: center;
    pointer-events: none;
}

.btn:active::after {
    animation: evaporate 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Particle elements */
.btn .particle {
    position: absolute;
    pointer-events: none;
    font-size: 1.2rem;
}

.btn.evaporating .particle {
    animation: particle-float 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ===== PERFECT SPACING & ALIGNMENT ===== */
.btn + .btn {
    margin-left: 0.5rem;
}

/* Golden ratio grid for button layouts */
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}
