/**
 * Professional Patio Calculator CSS
 * CalcTechLab.com
 * Modern, responsive, and accessible design
 */

/* ========================================
   1. RESET & BASE STYLES
   ======================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    color: #333;
}

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

/* ========================================
   2. HEADER SECTION
   ======================================== */

.calculator-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    animation: fadeInDown 0.6s ease;
}

.calculator-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.calculator-header .subtitle {
    font-size: 1.3rem;
    opacity: 0.95;
    font-weight: 300;
}

.calculator-header .icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: inline-block;
    animation: bounce 2s ease infinite;
}

/* ========================================
   3. MAIN LAYOUT
   ======================================== */

.calculator-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    margin-bottom: 40px;
}

/* ========================================
   4. CALCULATOR CARD
   ======================================== */

.calculator-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: fadeIn 0.8s ease;
}

.calculator-header-section {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    padding: 25px 30px;
    color: white;
}

.calculator-header-section h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.calculator-header-section p {
    opacity: 0.9;
    font-size: 1rem;
}

/* ========================================
   5. CALCULATOR FORM
   ======================================== */

.calculator-form {
    padding: 40px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    color: #1e40af;
    font-size: 1.2rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section .icon {
    font-size: 1.5rem;
}

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

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

.form-group label {
    font-weight: 600;
    color: #1e40af;
    font-size: 0.95rem;
}

.form-input,
.form-select {
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input[type="number"] {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
}

/* Waste Factor Slider */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #1e40af;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: #1e40af;
}

.slider-value {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: #2563eb;
    font-size: 1.1rem;
}

/* Price Inputs */
.price-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.price-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.price-input-wrapper::before {
    content: '$';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-weight: 600;
    z-index: 1;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    font-weight: 600;
    color: #64748b;
    pointer-events: none;
    z-index: 1;
}

.price-input {
    padding-left: 30px !important;
}

/* ========================================
   6. ACTION BUTTONS
   ======================================== */

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 150px;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.action-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

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

.action-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.action-btn-secondary {
    background: white;
    color: #2563eb;
    border: 2px solid #2563eb;
}

.action-btn-secondary:hover {
    background: #2563eb;
    color: white;
    transform: translateY(-2px);
}

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

/* PDF Download Button (Green) */
.action-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.action-btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

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

.action-btn-success:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   7. RESULTS SECTION
   ======================================== */

.results-section {
    display: none;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #e2e8f0;
}

.results-section.show {
    display: block;
}

.results-section h3 {
    color: #1e40af;
    font-size: 1.5rem;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.result-item {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #2563eb;
}

.result-label {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    color: #1e40af;
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* Cost Breakdown */
.cost-breakdown {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid #2563eb;
}

.cost-breakdown h4 {
    color: #1e40af;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.cost-item:last-child {
    border-bottom: none;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 2px solid #2563eb;
}

.total-cost-item {
    font-weight: 700;
    font-size: 1.2rem;
}

.cost-label {
    color: #1e40af;
}

.cost-value {
    color: #1e40af;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* ========================================
   8. SIDEBAR
   ======================================== */

.calculator-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: fadeInRight 0.8s ease;
}

.sidebar-card h3 {
    color: #2563eb;
    margin-bottom: 15px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Patio Visual Container - FIXED RESPONSIVE LAYOUT */
.patio-visual-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}

.patio-visual {
    width: 100%;
    max-width: 400px;
    min-height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8fafc;
    border-radius: 8px;
    padding: 15px;
    box-sizing: border-box;
}

.patio-visual svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Tips List */
.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    padding: 10px 0;
    color: #64748b;
    display: flex;
    align-items: start;
    gap: 10px;
}

.tips-list li::before {
    content: '💡';
    font-size: 1.2rem;
}

/* ========================================
   9. LOADING INDICATOR
   ======================================== */

.loading-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   10. NOTIFICATIONS
   ======================================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    font-weight: 600;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: #10b981;
    color: white;
}

.notification-error {
    background: #ef4444;
    color: white;
}

.notification-info {
    background: #2563eb;
    color: white;
}

/* ========================================
   11. SEO CONTENT SECTION
   ======================================== */

.seo-content {
    background: white;
    border-radius: 20px;
    padding: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-top: 40px;
}

.seo-content h2 {
    color: #2563eb;
    margin-bottom: 25px;
    font-size: 2.2rem;
}

.seo-content h3 {
    color: #1e40af;
    margin-top: 35px;
    margin-bottom: 15px;
    font-size: 1.6rem;
}

.seo-content h4 {
    color: #2563eb;
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.seo-content p {
    color: #64748b;
    line-height: 1.8;
    margin-bottom: 15px;
    font-size: 1.05rem;
}

.seo-content ul,
.seo-content ol {
    color: #64748b;
    line-height: 1.8;
    margin-bottom: 20px;
    padding-left: 30px;
}

.seo-content li {
    margin-bottom: 10px;
}

.seo-content strong {
    color: #1e40af;
    font-weight: 600;
}

.seo-content code {
    background: #f8fafc;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #2563eb;
}

/* Formula Box */
.formula-box {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #2563eb;
    margin: 20px 0;
}

.formula-box code {
    display: block;
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 1.1rem;
}

/* FAQ Section */
.faq-section {
    margin-top: 40px;
}

.faq-item {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #2563eb;
}

.faq-question {
    color: #1e40af;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.faq-answer {
    color: #64748b;
    line-height: 1.7;
}

/* ========================================
   12. ANIMATIONS
   ======================================== */

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

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

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

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

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

/* ========================================
   13. RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .calculator-layout {
        grid-template-columns: 1fr;
    }
    
    .calculator-sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .patio-visual-container {
        max-width: 350px;
        margin: 0 auto;
    }
    
    .patio-visual {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .calculator-header h1 {
        font-size: 2rem;
    }
    
    .calculator-header .subtitle {
        font-size: 1rem;
    }
    
    .calculator-form {
        padding: 25px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .price-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .seo-content {
        padding: 30px 20px;
    }
    
    .seo-content h2 {
        font-size: 1.8rem;
    }
    
    .patio-visual-container {
        max-width: 100%;
        padding: 5px;
    }
    
    .patio-visual {
        min-height: 220px;
        padding: 10px;
    }
    
    .calculator-sidebar {
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    .calculator-header h1 {
        font-size: 1.6rem;
    }
    
    .form-input,
    .form-select {
        font-size: 0.9rem;
    }
    
    .result-value {
        font-size: 1.4rem;
    }
    
    .patio-visual {
        min-height: 200px;
        padding: 8px;
    }
    
    .action-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
}

/* ========================================
   14. PRINT STYLES
   ======================================== */

@media print {
    body {
        background: white;
        padding: 20px;
    }
    
    .calculator-header {
        page-break-after: avoid;
    }
    
    .calculator-form,
    .action-buttons,
    .calculator-sidebar,
    .seo-content {
        display: none !important;
    }
    
    .results-section {
        display: block !important;
        page-break-inside: avoid;
        border: 2px solid #000;
        padding: 20px;
        margin: 20px 0;
    }
    
    .sidebar-card {
        page-break-inside: avoid;
        border: 1px solid #000;
        padding: 15px;
        margin: 15px 0;
    }
    
    .patio-visual-container {
        page-break-inside: avoid;
    }
    
    .patio-visual svg {
        max-width: 100%;
        height: auto;
    }
    
    .result-item,
    .cost-item {
        border: 1px solid #ddd;
        padding: 10px;
        margin: 5px 0;
    }
    
    .result-label,
    .cost-label {
        font-weight: bold;
        color: #000;
    }
    
    .result-value,
    .cost-value {
        color: #000;
        font-size: 1.2em;
    }
    
    h2, h3 {
        color: #000;
        page-break-after: avoid;
    }
    
    .calculator-header::after {
        content: "Calculation Results - Printed on " attr(data-print-date);
        display: block;
        font-size: 0.9rem;
        color: #666;
        margin-top: 10px;
    }
}

/* ========================================
   15. EMBED MODE STYLES
   ======================================== */

.embed-mode {
    padding: 0;
    background: transparent;
}

.embed-mode .calculator-header,
.embed-mode .calculator-sidebar,
.embed-mode .seo-content {
    display: none;
}

.embed-mode .calculator-card {
    border-radius: 0;
    box-shadow: none;
}

.embed-mode .calculator-layout {
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0;
}

/* Currency Selector Styles */
#currency-select {
    font-weight: 600;
    color: #1e40af;
    font-size: 1rem;
}
