/* Advanced Profit & Loss Calculator Styles */
.apl-calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

.apl-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e6ed;
}

.apl-header h2 {
    color: #2c3e50;
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 10px;
    background: linear-gradient(45deg, #3498db, #2c3e50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.apl-header p {
    color: #7f8c8d;
    font-size: 16px;
    margin: 0;
}

.apl-main-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

@media (max-width: 992px) {
    .apl-main-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Input Section */
.apl-input-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.apl-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f4f8;
    padding-bottom: 10px;
}

.apl-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: #7f8c8d;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    position: relative;
}

.apl-tab:hover {
    color: #3498db;
    background: #f8fafc;
}

.apl-tab.active {
    color: #3498db;
    background: #f0f7ff;
}

.apl-tab.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    width: 100%;
    height: 3px;
    background: #3498db;
    border-radius: 2px;
}

.apl-tab-content {
    min-height: 300px;
}

.apl-tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.apl-tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.apl-input-group {
    margin-bottom: 25px;
}

.apl-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.apl-label {
    display: inline-block;
    vertical-align: middle;
}

.apl-currency {
    display: inline-block;
    margin-left: 5px;
    color: #3498db;
    font-weight: 700;
}

.apl-input,
.apl-select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 16px;
    color: #2c3e50;
    background: white;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.apl-input:focus,
.apl-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.apl-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.apl-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.apl-slider {
    position: relative;
    width: 60px;
    height: 30px;
    background: #e0e6ed;
    border-radius: 15px;
    margin-right: 15px;
    transition: background-color 0.3s ease;
}

.apl-slider:before {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

input:checked + .apl-slider {
    background: #2ecc71;
}

input:checked + .apl-slider:before {
    transform: translateX(30px);
}

.apl-switch-label {
    font-weight: 600;
    color: #2c3e50;
}

.apl-action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f0f4f8;
}

.apl-button {
    padding: 16px 32px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.apl-button-primary {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.apl-button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
}

.apl-button-secondary {
    background: #f8fafc;
    color: #7f8c8d;
    border: 2px solid #e0e6ed;
}

.apl-button-secondary:hover {
    background: #eef2f7;
}

/* Results Section */
.apl-results-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.apl-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f4f8;
}

.apl-results-header h3 {
    color: #2c3e50;
    font-size: 24px;
    margin: 0;
}

.apl-button-icon {
    background: #f0f7ff;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    color: #3498db;
    font-size: 18px;
    transition: all 0.3s ease;
}

.apl-button-icon:hover {
    background: #3498db;
    color: white;
}

.apl-results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .apl-results-grid {
        grid-template-columns: 1fr;
    }
}

.apl-result-card {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.3s ease;
    border: 2px solid transparent;
}

.apl-result-card:hover {
    transform: translateY(-5px);
}

.apl-result-card.profit {
    border-color: #2ecc71;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1), rgba(46, 204, 113, 0.05));
}

.apl-result-card.loss {
    border-color: #e74c3c;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(231, 76, 60, 0.05));
}

.apl-result-card.break-even {
    border-color: #95a5a6;
    background: linear-gradient(135deg, rgba(149, 165, 166, 0.1), rgba(149, 165, 166, 0.05));
}

.apl-result-label {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.apl-result-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.apl-result-percentage {
    font-size: 16px;
    font-weight: 600;
}

.apl-profit-loss .apl-result-value.profit {
    color: #2ecc71;
}

.apl-profit-loss .apl-result-value.loss {
    color: #e74c3c;
}

.apl-profit-loss .apl-result-value.break-even {
    color: #95a5a6;
}

.apl-chart-section {
    margin: 30px 0;
    padding: 25px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid #e0e6ed;
}

.apl-chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 20px;
}

.apl-chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #2c3e50;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.apl-breakdown {
    background: #f8fafc;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #e0e6ed;
}

.apl-breakdown h4 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
}

.apl-breakdown-table {
    width: 100%;
    border-collapse: collapse;
}

.apl-breakdown-table tr {
    border-bottom: 1px solid #e0e6ed;
}

.apl-breakdown-table tr:last-child {
    border-bottom: none;
}

.apl-breakdown-table td {
    padding: 12px 0;
    color: #2c3e50;
}

.apl-breakdown-table td:first-child {
    font-weight: 600;
}

.apl-breakdown-table td:last-child {
    text-align: right;
    font-weight: 700;
    color: #3498db;
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

.profit-pulse {
    animation: pulse 2s infinite;
}

/* Loading state */
.apl-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.apl-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f0f4f8;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print styles */
@media print {
    .apl-calculator-container {
        box-shadow: none;
        padding: 0;
    }
    
    .apl-button,
    .apl-button-icon {
        display: none;
    }
}