/**
 * PSX Trading Calculator - Main Stylesheet
 * 
 * Features:
 * - Dark mode professional trading dashboard
 * - Bootstrap 5.3 integration
 * - Responsive mobile-first design
 * - Smooth transitions and animations
 */

/* Root Variables */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-bg: #0d1117;
    --card-bg: #1c1f26;
    --text-light: #e1e4e8;
    --border-color: #30363d;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Styles */
.psx-trading-calculator-wrapper {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    color: var(--text-light);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    padding: 20px 0;
}

/* Header Styles */
.calculator-header {
    animation: fadeInDown 0.6s ease-out;
}

.calculator-header h1 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.calculator-header p {
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 0.3px;
}

/* Card Styles */
.card {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.card:hover {
    border-color: #30363d !important;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15) !important;
    transform: translateY(-2px);
}

.card-header {
    background: var(--primary-gradient) !important;
    border-color: var(--border-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: white !important;
    padding: 1.25rem !important;
    border-radius: 11px 11px 0 0 !important;
}

.card-header h5 {
    margin-bottom: 0;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.card-body {
    padding: 1.75rem !important;
    color: var(--text-light);
}

/* Result Card Specific Styles */
.result-card {
    background-color: rgba(28, 31, 38, 0.8) !important;
}

.result-card:nth-child(2) .card-header {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
}

.result-card:nth-child(3) .card-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
}

.result-card:nth-child(4) .card-header {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
}

/* Form Styles */
.calculator-form-container {
    animation: fadeInLeft 0.6s ease-out;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    color: var(--text-light);
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 0.75rem !important;
}

.form-control {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-light) !important;
    border-radius: 8px;
    transition: var(--transition);
    padding: 0.875rem 1rem;
    font-weight: 500;
}

.form-control:focus {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    color: var(--text-light) !important;
}

.form-control::placeholder {
    color: rgba(225, 228, 232, 0.5);
}

.input-group-text {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-light) !important;
    border-radius: 8px;
    font-weight: 600;
}

.input-group .form-control {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.input-group-lg .input-group-text {
    padding: 0.875rem 1.25rem;
    font-size: 1.025rem;
}

.input-group-lg .form-control {
    padding: 0.875rem 1rem;
    font-size: 1.025rem;
}

/* Button Styles */
.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
    border: none;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--primary-gradient) !important;
    color: white !important;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-light) !important;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: #667eea !important;
    color: white !important;
}

.btn-success {
    background: var(--success-gradient) !important;
    color: white !important;
}

.btn-outline-primary {
    color: #667eea;
    border: 2px solid #667eea;
    background-color: transparent;
    border-radius: 8px;
}

.btn-outline-primary:hover,
.btn-outline-primary.active,
.btn-check:checked + .btn-outline-primary {
    background: var(--primary-gradient) !important;
    color: white !important;
    border-color: #667eea !important;
}

.btn-outline-success {
    color: #11998e;
    border: 2px solid #11998e;
    background-color: transparent;
    border-radius: 8px;
}

.btn-outline-success:hover,
.btn-outline-success.active,
.btn-check:checked + .btn-outline-success {
    background: var(--success-gradient) !important;
    color: white !important;
    border-color: #11998e !important;
}

.btn-outline-info {
    color: #4facfe;
    border: 2px solid #4facfe;
    background-color: transparent;
    border-radius: 8px;
}

.btn-outline-info:hover,
.btn-outline-info.active,
.btn-check:checked + .btn-outline-info {
    background: var(--info-gradient) !important;
    color: white !important;
    border-color: #4facfe !important;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

.btn-group .btn {
    flex: 1;
    margin: 0;
    border-radius: 8px;
}

.btn-group .rounded-start {
    border-radius: 8px 0 0 8px;
}

.btn-group .rounded-end {
    border-radius: 0 8px 8px 8px;
}

/* Result Item Styles */
.result-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--transition);
}

.result-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: #667eea;
}

.result-item .label {
    font-size: 0.875rem;
    color: rgba(225, 228, 232, 0.7);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.result-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #38ef7d;
    letter-spacing: -0.5px;
    word-break: break-word;
}

.result-item .value.highlight {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.1), rgba(56, 239, 125, 0.1));
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 4px solid #38ef7d;
}

.result-item .value.profit {
    color: #38ef7d;
}

.result-item .value.loss {
    color: #f45c43;
}

.result-breakdown {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: rgba(225, 228, 232, 0.8);
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-item span:last-child {
    font-weight: 600;
    color: var(--text-light);
}

.breakdown-item.total {
    border-top: 2px solid var(--border-color);
    padding-top: 0.75rem;
    padding-bottom: 0;
    font-weight: 700;
    font-size: 1rem;
    color: #38ef7d;
}

.breakdown-item.total span:last-child {
    color: #38ef7d;
    font-size: 1.1rem;
}

/* Final Result Card */
.final-result {
    font-size: 2.5rem !important;
    font-weight: 700 !important;
    padding: 1.5rem !important;
    border-radius: 12px !important;
    text-align: center !important;
    background: linear-gradient(135deg, rgba(56, 239, 125, 0.1), rgba(17, 153, 142, 0.1)) !important;
    border-left: 6px solid #38ef7d !important;
    letter-spacing: -0.8px;
}

.final-result.loss {
    color: #f45c43 !important;
    background: linear-gradient(135deg, rgba(244, 92, 67, 0.1), rgba(235, 51, 73, 0.1)) !important;
    border-left-color: #f45c43 !important;
}

/* Calculator Results Container */
.calculator-results {
    animation: fadeInRight 0.6s ease-out;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Responsive Mobile Design */
@media (max-width: 991.98px) {
    .psx-trading-calculator-wrapper {
        padding: 10px 0;
    }

    .calculator-header h1 {
        font-size: 2rem;
    }

    .calculator-header p {
        font-size: 1rem;
    }

    .card-body {
        padding: 1.25rem !important;
    }

    .result-item {
        padding: 0.75rem;
    }

    .result-item .value {
        font-size: 1.25rem;
    }

    .breakdown-item {
        font-size: 0.875rem;
    }

    .final-result {
        font-size: 1.75rem !important;
    }

    .btn-group {
        flex-wrap: wrap;
    }

    .btn-group .btn {
        flex: 1 1 48%;
        border-radius: 8px !important;
    }

    .btn-group .rounded-start {
        border-radius: 8px;
    }

    .btn-group .rounded-end {
        border-radius: 8px;
    }

    .form-control {
        padding: 0.75rem 0.875rem;
        font-size: 1rem;
    }

    .input-group-text {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 576px) {
    .calculator-header h1 {
        font-size: 1.5rem;
    }

    .calculator-header p {
        font-size: 0.95rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .card-header h5 {
        font-size: 1.1rem;
    }

    .card-body {
        padding: 1rem !important;
    }

    .row {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }

    .result-item {
        padding: 0.625rem;
    }

    .result-item .value {
        font-size: 1.1rem;
    }

    .result-item .label {
        font-size: 0.75rem;
    }

    .final-result {
        font-size: 1.5rem !important;
        padding: 1rem !important;
    }

    .breakdown-item {
        font-size: 0.8rem;
        padding: 0.5rem 0;
    }

    .form-label {
        font-size: 0.95rem;
    }

    .form-control,
    .input-group-text {
        font-size: 1rem;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.95rem;
    }

    .btn-lg {
        padding: 0.75rem 1.25rem;
    }

    .btn-group {
        gap: 0.375rem;
    }

    .btn-group .btn {
        flex: 1;
        font-size: 0.9rem;
    }

    .result-breakdown {
        padding: 0.75rem;
    }
}

/* Dark Mode Scrollbar for Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #667eea rgba(0, 0, 0, 0.1);
}

/* Utility Classes */
.bg-gradient {
    background: var(--primary-gradient) !important;
}

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-lg {
    box-shadow: 0 10px 40px var(--shadow-color) !important;
}

/* Print Styles */
@media print {
    .psx-trading-calculator-wrapper {
        background: white;
        color: black;
    }

    .card {
        page-break-inside: avoid;
        background-color: white !important;
        border: 1px solid #ddd !important;
        color: black;
    }

    .card-header {
        background-color: #f8f9fa !important;
        color: black !important;
    }

    .form-control {
        background-color: white !important;
        color: black !important;
        border: 1px solid #ddd !important;
    }
}
