@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
    --primary: #0a0e27;
    --primary-light: #1a1f3a;
    --accent: #00d4ff;
    --accent-dark: #00a8cc;
    --accent-glow: rgba(0, 212, 255, 0.3);
    --success: #00ff88;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --bg-gradient: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    --card-bg: rgba(26, 31, 58, 0.6);
    --border-color: rgba(0, 212, 255, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

* {
    box-sizing: border-box;
}

.sqft-calculator-wrapper {
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.sqft-calculator-container {
    background: var(--bg-gradient);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.sqft-calculator-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    opacity: 0.1;
    pointer-events: none;
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.1; }
    50% { transform: scale(1.1); opacity: 0.15; }
}

.calculator-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.calculator-title {
    font-family: 'Space Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInDown 0.6s ease-out;
}

.calculator-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

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

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

.calculator-body {
    position: relative;
    z-index: 1;
}

/* Shape Selector */
.shape-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
    animation: fadeIn 0.6s ease-out 0.3s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.shape-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.shape-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

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

.shape-btn svg {
    width: 40px;
    height: 40px;
    transition: all 0.3s ease;
}

.shape-btn span {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
    line-height: 1.2;
}

.shape-btn:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.2);
    color: var(--accent);
}

.shape-btn.active {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: var(--shadow-glow);
    transform: scale(1.05);
}

.shape-btn.active svg {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}

/* Forms */
.shape-form {
    display: none;
    animation: slideIn 0.4s ease-out;
}

.shape-form.active {
    display: block;
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.1);
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Space Mono', monospace;
    outline: none;
}

.unit-select {
    background: rgba(0, 212, 255, 0.1);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    font-family: 'Work Sans', sans-serif;
}

.unit-select option {
    background: var(--primary);
    color: var(--text-primary);
}

input[type="number"] {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Space Mono', monospace;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    outline: none;
}

input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.1);
}

input[type="number"]::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Remove spinner from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 0.5;
}

/* Calculate Button */
.calculate-btn {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.calculate-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.calculate-btn:hover::before {
    width: 300px;
    height: 300px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.5);
}

.calculate-btn:active {
    transform: translateY(0);
}

.calculate-btn svg {
    transition: transform 0.3s ease;
}

.calculate-btn:hover svg {
    transform: translateX(4px);
}

/* Results Display */
.calculation-results {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.calculation-results.hidden {
    display: none;
}

.result-card {
    background: var(--bg-gradient);
    border: 2px solid var(--accent);
    border-radius: 24px;
    padding: 48px;
    max-width: 500px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 212, 255, 0.3);
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.close-result {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-result:hover {
    background: var(--accent);
    color: var(--primary);
    transform: rotate(90deg);
}

.result-icon {
    text-align: center;
    margin-bottom: 24px;
}

.result-icon svg {
    stroke: var(--accent);
    filter: drop-shadow(0 0 12px var(--accent-glow));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.result-title {
    font-family: 'Space Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin: 0 0 32px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-item {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.result-item:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.result-item.highlight {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(0, 212, 255, 0.05));
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.result-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.result-item.highlight .result-value {
    font-size: 2rem;
    color: var(--success);
    text-shadow: 0 0 12px rgba(0, 255, 136, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sqft-calculator-container {
        padding: 24px;
        border-radius: 16px;
    }
    
    .calculator-title {
        font-size: 1.75rem;
    }
    
    .shape-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .result-card {
        padding: 32px 24px;
    }
    
    .result-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .sqft-calculator-wrapper {
        padding: 12px;
    }
    
    .calculator-title {
        font-size: 1.5rem;
    }
    
    .calculator-subtitle {
        font-size: 0.875rem;
    }
    
    .shape-btn {
        padding: 16px 12px;
    }
    
    .shape-btn svg {
        width: 32px;
        height: 32px;
    }
}
