/* Stock Profit Loss Calculator - Mobile First Responsive CSS */

/* Reset and Base Styles */
.splc-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

/* Title Container */
.splc-title-container {
    background: #2CEC00;
    color: white;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
}

.splc-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.splc-subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
}

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

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

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

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

.splc-input {
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 1rem;
    min-height: 44px;
    width: 100%;
    transition: border-color 0.15s ease-in-out;
}

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

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

/* Advanced Options */
.splc-advanced-toggle {
    margin: 1rem 0;
    text-align: center;
}

.splc-toggle-btn {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    width: 100%;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    font-size: 0.875rem;
    color: #374151;
    background: white;
}

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

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

.splc-advanced-options {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    animation: fadeIn 0.3s ease;
}

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

/* Buttons */
.splc-calculate-btn-container {
    margin-top: 1.5rem;
    text-align: center;
}

.splc-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    transition: all 0.15s ease-in-out;
    width: 100%;
    margin-bottom: 0.5rem;
}

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

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

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

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

.splc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.splc-loading {
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

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

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

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

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

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

.splc-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
}

.splc-summary-percent {
    font-size: 0.875rem;
    font-weight: 500;
}

.splc-summary-sub {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Progress Bar */
.splc-progress-container {
    margin: 1.5rem 0;
}

.splc-progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.splc-progress-bar {
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 0.25rem;
    overflow: hidden;
}

.splc-progress-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 0.25rem;
    width: 0%;
    transition: width 1s ease-in-out;
}

/* Charts Section */
.splc-charts-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.splc-chart-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    height: 250px !important;
    position: relative;
}

.splc-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Details Section */
.splc-details-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1.5rem 0;
}

.splc-details-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #374151;
}

.splc-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.splc-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.splc-detail-item:last-child {
    border-bottom: none;
}

/* Timeline Table */
.splc-timeline-section {
    margin: 1.5rem 0;
}

.splc-timeline-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #374151;
}

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

.splc-timeline-table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
}

.splc-timeline-table th,
.splc-timeline-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.splc-timeline-table th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.splc-timeline-table td {
    font-size: 0.875rem;
}

.splc-timeline-table tr:last-child td {
    border-bottom: none;
}

/* Action Buttons */
.splc-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* Tablet Styles (481px - 768px) */
@media (min-width: 481px) {
    .splc-title {
        font-size: 1.75rem;
    }
    
    .splc-input-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .splc-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .splc-action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .splc-btn {
        width: auto;
        margin-bottom: 0;
    }
}

/* Desktop Styles (> 768px) */
@media (min-width: 768px) {
    .splc-container {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .splc-title {
        font-size: 2rem;
    }
    
    .splc-input-section,
    .splc-results-section {
        padding: 2rem;
    }
    
    .splc-summary-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .splc-charts-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .splc-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .splc-action-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .splc-btn {
        width: 100%;
    }
}

/* Small Mobile (≤ 360px) */
@media (max-width: 360px) {
    .splc-title {
        font-size: 1.25rem;
    }
    
    .splc-subtitle {
        font-size: 0.75rem;
    }
    
    .splc-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .splc-summary-value {
        font-size: 1.25rem;
    }
}

/* Print Styles */
@media print {
    .splc-toggle-btn,
    .splc-btn,
    .splc-advanced-options {
        display: none !important;
    }
    
    .splc-results-section {
        display: block !important;
    }
    
    .splc-container {
        background: white !important;
        color: black !important;
    }
    
    .splc-title-container {
        background: #2CEC00 !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .splc-summary-card,
    .splc-details-section,
    .splc-table-container {
        border: 1px solid #000 !important;
    }
}