/* Debt Snowball Calculator - Mobile First Responsive CSS */
/* Reset and Base Styles */

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

.dsc-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #111827;
    background-color: #ffffff;
    line-height: 1.5;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

/* Title Section */
.dsc-title-container {
    background-color: #2CEC00;
    color: white;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    max-width: 100%;
    overflow: hidden;
}

.dsc-title-container h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dsc-title-container p {
    font-size: 1rem;
    opacity: 0.9;
}

/* Container */
.dsc-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Input Section */
.dsc-input-section {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.dsc-input-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #111827;
}

/* Debts Container */
.dsc-debts-container {
    margin-bottom: 2rem;
}

.dsc-debt-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
}

.dsc-debt-header {
    display: none; /* Hidden on mobile */
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: #4b5563;
}

.dsc-debt-name,
.dsc-debt-balance,
.dsc-debt-interest,
.dsc-debt-min-payment,
.dsc-debt-actions {
    display: flex;
    flex-direction: column;
}

.dsc-debt-name label,
.dsc-debt-balance label,
.dsc-debt-interest label,
.dsc-debt-min-payment label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

/* Input Styles */
.dsc-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: white;
    color: #111827;
    min-height: 44px; /* Touch target */
}

.dsc-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.dsc-input::placeholder {
    color: #9ca3af;
}

/* Buttons */
.dsc-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px; /* Touch target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.dsc-btn-primary {
    background-color: #22c55e;
    color: white;
}

.dsc-btn-primary:hover {
    background-color: #16a34a;
}

.dsc-btn-secondary {
    background-color: #2563eb;
    color: white;
}

.dsc-btn-secondary:hover {
    background-color: #1d4ed8;
}

.dsc-btn-text {
    background: transparent;
    color: #2563eb;
    padding: 0.5rem;
}

.dsc-btn-text:hover {
    text-decoration: underline;
}

#dsc-add-debt {
    width: 100%;
    margin-top: 1rem;
}

.dsc-remove-debt {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 0.25rem;
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Additional Inputs */
.dsc-additional-inputs {
    margin-bottom: 1.5rem;
}

.dsc-additional-inputs h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #111827;
}

.dsc-input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.dsc-input-group {
    display: flex;
    flex-direction: column;
}

.dsc-input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

/* Advanced Options */
.dsc-advanced-toggle {
    margin-bottom: 1.5rem;
}

.dsc-advanced-options {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
}

.dsc-toggle-icon {
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.3s;
}

.dsc-advanced-options.active .dsc-toggle-icon {
    transform: rotate(180deg);
}

/* Calculate Container */
.dsc-calculate-container {
    position: relative;
}

.dsc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    color: #4b5563;
}

.dsc-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #e5e7eb;
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: dsc-spin 0.8s linear infinite;
}

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

/* Results Section */
.dsc-results-section {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 2rem;
    animation: dsc-fadeIn 0.5s ease;
}

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

.dsc-results-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #111827;
}

/* Summary Cards */
.dsc-summary-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.dsc-summary-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dsc-summary-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.dsc-summary-content h3 {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.dsc-summary-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

/* Progress Bar */
.dsc-progress-container {
    margin-bottom: 2rem;
}

.dsc-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.dsc-progress-bar {
    height: 0.75rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.dsc-progress-fill {
    height: 100%;
    background: #22c55e;
    transition: width 1s ease;
}

/* Charts Section */
.dsc-charts-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.dsc-chart-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.25rem;
}

.dsc-chart-container h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: #111827;
}

.dsc-chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
    max-width: 100%;
}

.dsc-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    display: block;
}

/* Breakdown Section */
.dsc-breakdown-section {
    margin-bottom: 2rem;
}

.dsc-breakdown-section h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: #111827;
}

.dsc-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.dsc-breakdown-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

.dsc-breakdown-table th {
    background: #f3f4f6;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e5e7eb;
}

.dsc-breakdown-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.dsc-breakdown-table tr:last-child td {
    border-bottom: none;
}

.dsc-breakdown-table tbody tr:hover {
    background: #f9fafb;
}

/* Action Buttons */
.dsc-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

/* Error Container */
.dsc-error-container {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
    display: none;
}

.dsc-error-container.show {
    display: block;
    animation: dsc-fadeIn 0.3s ease;
}

/* Media Queries */

/* Tablet (481px - 768px) */
@media (min-width: 481px) {
    .dsc-title-container h1 {
        font-size: 2rem;
    }
    
    .dsc-title-container {
        padding: 2rem 1.5rem;
    }
    
    .dsc-container {
        padding: 0 1.5rem;
    }
    
    .dsc-input-section,
    .dsc-results-section {
        padding: 2rem;
    }
    
    .dsc-debt-row {
        grid-template-columns: 2fr 1fr 1fr 1fr auto;
        gap: 1rem;
        align-items: center;
    }
    
    .dsc-debt-header {
        display: grid;
    }
    
    .dsc-debt-name label,
    .dsc-debt-balance label,
    .dsc-debt-interest label,
    .dsc-debt-min-payment label {
        display: none;
    }
    
    .dsc-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dsc-input-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop (> 768px) */
@media (min-width: 769px) {
    .dsc-container {
        max-width: 1200px;
        padding: 0 2rem;
    }
    
    .dsc-title-container h1 {
        font-size: 2.25rem;
    }
    
    .dsc-input-section h2,
    .dsc-results-section h2 {
        font-size: 1.75rem;
    }
    
    .dsc-summary-cards {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .dsc-charts-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dsc-chart-wrapper {
        height: 250px;
    }
    
    .dsc-action-buttons {
        justify-content: flex-start;
    }
    
    .dsc-btn {
        padding: 0.875rem 2rem;
    }
}

/* Small Mobile (≤ 360px) */
@media (max-width: 360px) {
    .dsc-title-container h1 {
        font-size: 1.5rem;
    }
    
    .dsc-title-container p {
        font-size: 0.875rem;
    }
    
    .dsc-input-section,
    .dsc-results-section {
        padding: 1.25rem;
    }
    
    .dsc-summary-card {
        padding: 1rem;
    }
    
    .dsc-summary-amount {
        font-size: 1.25rem;
    }
    
    .dsc-chart-wrapper {
        height: 250px;
    }
}

/* Print Styles */
@media print {
    .dsc-wrapper {
        background: white;
    }
    
    .dsc-title-container {
        background: #2CEC00 !important;
        -webkit-print-color-adjust: exact;
        color: white !important;
    }
    
    .dsc-btn,
    .dsc-advanced-toggle,
    .dsc-calculate-container,
    .dsc-action-buttons {
        display: none !important;
    }
    
    .dsc-input-section,
    .dsc-results-section {
        border: 1px solid #000;
        break-inside: avoid;
    }
    
    .dsc-chart-wrapper canvas {
        max-height: 200px !important;
    }
    
    .dsc-table-container {
        overflow: visible;
        max-width: 100%;
    }
    
    .dsc-breakdown-table {
        min-width: auto;
        width: 100%;
    }
}