/* Crypto Mining Calculator - Main Stylesheet */
/* Mobile-First Responsive Design */

/* ===== RESET & BASE STYLES ===== */
.cmc-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.cmc-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: #111827;
    background-color: #ffffff;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
}

/* ===== TYPOGRAPHY ===== */
.cmc-title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.cmc-subtitle {
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 400;
    opacity: 0.9;
}

.cmc-results-title {
    font-size: clamp(1.25rem, 4vw, 2rem);
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #111827;
}

h3 {
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* ===== TITLE CONTAINER ===== */
.cmc-title-container {
    background-color: #2CEC00;
    color: #ffffff;
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    border-radius: 0;
    width: 100%;
}

/* ===== MAIN CONTAINER ===== */
.cmc-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== INPUT SECTION ===== */
.cmc-input-section {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.cmc-input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

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

.cmc-help-text {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.cmc-input-group input {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.15s ease;
    background-color: #ffffff;
    min-height: 44px; /* Touch-friendly */
}

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

.cmc-input-group input:invalid {
    border-color: #dc2626;
}

.cmc-error {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    min-height: 1rem;
}

/* ===== ADVANCED OPTIONS ===== */
.cmc-advanced-toggle {
    margin-bottom: 1rem;
}

.cmc-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: #2563eb;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    min-height: 44px;
}

.cmc-toggle-icon {
    transition: transform 0.3s ease;
}

.cmc-toggle-btn.active .cmc-toggle-icon {
    transform: rotate(180deg);
}

.cmc-advanced-options {
    display: none;
    animation: slideDown 0.3s ease;
}

.cmc-advanced-options.active {
    display: block;
}

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

/* ===== BUTTONS ===== */
.cmc-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 44px; /* Touch-friendly */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cmc-btn-primary {
    background-color: #22c55e;
    color: #ffffff;
}

.cmc-btn-primary:hover,
.cmc-btn-primary:focus {
    background-color: #16a34a;
    transform: translateY(-1px);
}

.cmc-btn-secondary {
    background-color: #2563eb;
    color: #ffffff;
}

.cmc-btn-secondary:hover,
.cmc-btn-secondary:focus {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.cmc-form-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ===== LOADING INDICATOR ===== */
.cmc-loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.cmc-loading.active {
    display: block;
}

.cmc-loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #22c55e;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== RESULTS SECTION ===== */
.cmc-results-section {
    display: none;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    animation: fadeIn 0.5s ease;
}

.cmc-results-section.active {
    display: block;
}

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

/* ===== SUMMARY CARDS ===== */
.cmc-summary-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.cmc-summary-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.cmc-summary-card h3 {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

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

.cmc-summary-value.negative {
    color: #dc2626;
}

/* ===== PROGRESS BAR ===== */
.cmc-progress-section {
    margin-bottom: 2rem;
}

.cmc-progress-bar {
    height: 1.5rem;
    background-color: #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.cmc-progress-fill {
    height: 100%;
    background-color: #22c55e;
    border-radius: 0.75rem;
    transition: width 1s ease;
    width: 0%;
}

.cmc-progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
}

/* ===== CHARTS ===== */
.cmc-charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.cmc-chart-wrapper {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
}

.cmc-chart-wrapper h3 {
    text-align: center;
}

.cmc-chart-wrapper canvas {
    width: 100% !important;
    height: 300px !important;
    max-height: 300px;
}

/* ===== BREAKDOWN SECTION ===== */
.cmc-breakdown-section {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.cmc-breakdown-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.cmc-breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
}

.cmc-breakdown-item:last-child {
    border-bottom: none;
    font-weight: 600;
}

.cmc-breakdown-item span:first-child {
    color: #6b7280;
}

.cmc-breakdown-item span:last-child {
    font-weight: 500;
    color: #111827;
}

/* ===== TIMELINE TABLE ===== */
.cmc-timeline-section {
    margin-bottom: 2rem;
}

.cmc-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}

.cmc-timeline-table {
    width: 100%;
    min-width: 600px; /* Ensures horizontal scroll on mobile */
    border-collapse: collapse;
    font-size: 0.75rem;
}

.cmc-timeline-table th,
.cmc-timeline-table td {
    padding: 0.5rem;
    text-align: right;
    border-bottom: 1px solid #e5e7eb;
}

.cmc-timeline-table th:first-child,
.cmc-timeline-table td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background-color: #ffffff;
    z-index: 1;
}

.cmc-timeline-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
    position: sticky;
    top: 0;
    z-index: 2;
}

.cmc-timeline-table tr:hover {
    background-color: #f9fafb;
}

/* ===== RESULTS ACTIONS ===== */
.cmc-results-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ===== NOTIFICATION STYLES ===== */
.cmc-notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.cmc-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.cmc-notification-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.cmc-notification-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.cmc-notification-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablet (481px - 768px) */
@media (min-width: 481px) {
    .cmc-container {
        padding: 0 1.5rem;
    }
    
    .cmc-input-section,
    .cmc-results-section {
        padding: 2rem;
    }
    
    .cmc-form-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .cmc-results-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .cmc-timeline-table {
        font-size: 0.875rem;
    }
}

/* Desktop (> 768px) */
@media (min-width: 768px) {
    .cmc-input-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cmc-summary-cards {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .cmc-charts-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cmc-breakdown-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cmc-breakdown-item {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .cmc-title-container {
        border-radius: 0.5rem;
        margin: 0 auto 2rem;
        max-width: 1280px;
    }
}

/* Small Desktop (> 1024px) */
@media (min-width: 1024px) {
    .cmc-container {
        padding: 0 2rem;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .cmc-btn,
    .cmc-advanced-toggle,
    .cmc-form-actions,
    .cmc-results-actions {
        display: none !important;
    }
    
    .cmc-results-section {
        display: block !important;
        border: none;
        padding: 0;
    }
    
    .cmc-title-container {
        background-color: #000000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .cmc-chart-wrapper canvas {
        max-height: 200px !important;
    }
}

/* ===== ACCESSIBILITY ===== */
.cmc-btn:focus,
.cmc-toggle-btn:focus,
input:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
/* Add to the end of your existing style.css file */

/* Debug Panel Styles */
#cmc-debug-panel {
    font-family: monospace;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
}

#cmc-debug-info {
    margin-top: 5px;
    color: #333;
}

/* AJAX Status Styles */
#cmc-ajax-status {
    font-size: 14px;
    margin-top: 15px;
    transition: all 0.3s ease;
}

/* Button Styles for Test Button */
.cmc-btn[style*="background:#9333ea"] {
    background-color: #9333ea !important;
}

.cmc-btn[style*="background:#9333ea"]:hover {
    background-color: #7e22ce !important;
}

/* Small text for very small values */
small {
    font-size: 0.85em;
    opacity: 0.8;
}
/* Notification Styles */
.cmc-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

.cmc-notification-success {
    background-color: #22c55e;
}

.cmc-notification-error {
    background-color: #dc2626;
}

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

/* Negative values in red */
.cmc-summary-value.negative {
    color: #dc2626 !important;
}

/* Loading spinner fix */
.cmc-loading {
    display: none;
    text-align: center;
    padding: 30px;
}

.cmc-loading.active {
    display: block;
}

.cmc-loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #22c55e;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}