/* Crypto Profit/Loss Calculator Specific Styles */

/* Trade Section Styling */
.trade-section {
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: var(--card-background);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.trade-section:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.trade-section h3 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--secondary-color);
}

/* Fee Type Radio Group Styling */
.fee-type-group .radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.fee-type-group .radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    background: var(--input-background);
    transition: all 0.3s ease;
}

.fee-type-group .radio-group label:hover {
    border-color: var(--primary-color);
    background: var(--hover-background);
}

.fee-type-group .radio-group input[type="radio"]:checked + label,
.fee-type-group .radio-group label:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background: var(--primary-color-light);
    color: var(--primary-color);
}

.fee-type-group .radio-group input[type="radio"] {
    margin: 0;
}

/* Trade Actions */
.trade-actions {
    margin-top: 1.5rem;
    text-align: right;
}

.remove-trade {
    background: #dc3545;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.remove-trade:hover {
    background: #c82333;
}

/* Results Section Styling */
.results-section {
    background: var(--card-background);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
}

.results-title {
    color: var(--text-color);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 1rem;
}

/* Profit/Loss Indicators */
.profit-indicator.positive {
    border-left: 4px solid #28a745;
}

.profit-indicator.negative {
    border-left: 4px solid #dc3545;
}

.profit-indicator.neutral {
    border-left: 4px solid #6c757d;
}

.profit-indicator.positive h4 {
    color: #28a745;
}

.profit-indicator.negative h4 {
    color: #dc3545;
}

.profit-indicator.neutral h4 {
    color: #6c757d;
}

.profit-indicator.positive p {
    color: #28a745;
    font-weight: bold;
}

.profit-indicator.negative p {
    color: #dc3545;
    font-weight: bold;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-item {
    text-align: center;
    padding: 1.5rem;
}

.result-item h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 600;
}

.result-item p {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
    color: var(--primary-color);
}

.result-item small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    color: var(--muted-text);
    font-weight: normal;
}

/* Trade Breakdown */
.trade-breakdown-container {
    margin-top: 1.5rem;
}

.individual-trade-result {
    background: var(--input-background);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.individual-trade-result h5 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.trade-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.trade-stat {
    text-align: center;
}

.trade-stat .label {
    font-size: 0.85rem;
    color: var(--muted-text);
    margin-bottom: 0.25rem;
}

.trade-stat .value {
    font-weight: bold;
    color: var(--text-color);
}

.trade-stat.profit .value {
    color: #28a745;
}

.trade-stat.loss .value {
    color: #dc3545;
}

/* Form Actions Enhancement */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

#addTradeButton {
    background: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

#addTradeButton:hover {
    background: var(--secondary-color-dark);
    border-color: var(--secondary-color-dark);
}

/* Error Messages */
.error-messages {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.error-messages ul {
    margin: 0;
    padding-left: 1.5rem;
}

.error-messages li {
    margin-bottom: 0.5rem;
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
    .error-messages {
        background: rgba(220, 53, 69, 0.1);
        border-color: rgba(220, 53, 69, 0.3);
        color: #f8d7da;
    }
    
    .individual-trade-result {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.15);
    }
}

/* Dark mode class-based (when dark-mode class is applied to body) */
.dark-mode .error-messages {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.3);
    color: #f8d7da;
}

.dark-mode .individual-trade-result {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Responsive Design */
@media (max-width: 768px) {
    .trade-section {
        padding: 1rem;
    }
    
    .fee-type-group .radio-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .trade-summary {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .result-item p {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .trade-section h3 {
        font-size: 1.1rem;
    }
    
    .results-title {
        font-size: 1.25rem;
    }
    
    .result-item {
        padding: 1rem;
    }
    
    .result-item p {
        font-size: 1.1rem;
    }
    
    .trade-summary {
        grid-template-columns: 1fr;
    }
}

/* Animation for adding/removing trades */
.trade-section {
    animation: slideIn 0.5s ease-out;
}

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

.trade-section.removing {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 500px;
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
        margin-bottom: 0;
        padding: 0;
    }
}

/* Success/Warning Indicators */
.success-indicator {
    color: #28a745;
    font-weight: bold;
}

.warning-indicator {
    color: #ffc107;
    font-weight: bold;
}

.danger-indicator {
    color: #dc3545;
    font-weight: bold;
}

/* Tooltip-like hints */
.form-group label[title]:after {
    content: " ℹ️";
    cursor: help;
}

/* Focus states for better accessibility */
.fee-type-group .radio-group label:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

input[type="radio"]:focus {
    outline: none; /* Handled by parent label */
}

/* Print styles */
@media print {
    .form-actions,
    .trade-actions {
        display: none;
    }
    
    .trade-section,
    .results-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}