* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.container {
    width: 100%;
    max-width: 1200px;
}

.calculator-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease-out;
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.input-section {
    flex: 1;
    min-width: 0;
}

#profitCalculator {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

#profitCalculator .form-group {
    margin-bottom: 0;
}

#profitCalculator .calculate-btn {
    grid-column: 1 / -1;
    margin-top: 0;
}

#profitCalculator .other-costs-group {
    grid-column: 1 / -1;
}

.results-section {
    flex: 1;
    min-width: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    color: #333;
    font-size: 1.8em;
    margin-bottom: 5px;
    text-align: center;
}

.subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.form-group {
    margin-bottom: 12px;
}

label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency {
    position: absolute;
    left: 10px;
    color: #667eea;
    font-weight: 600;
    font-size: 0.95em;
    z-index: 1;
}

input[type="number"] {
    width: 100%;
    padding: 8px 10px 8px 30px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95em;
    transition: all 0.3s ease;
    background: #f9f9f9;
}

input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="number"]:hover {
    border-color: #667eea;
}

input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95em;
    transition: all 0.3s ease;
    background: #f9f9f9;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="text"]:hover {
    border-color: #667eea;
}

.other-cost-item {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.other-cost-item .other-cost-name {
    flex: 1;
    min-width: 0;
}

.other-cost-item .input-wrapper {
    flex: 1;
    min-width: 0;
}

.remove-other-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.2em;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    line-height: 1;
}

.remove-other-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.add-other-btn {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 15px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 5px;
}

.add-other-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.percentage {
    position: absolute;
    right: 10px;
    color: #667eea;
    font-weight: 600;
    font-size: 0.95em;
    z-index: 1;
}

.calculate-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.calculate-btn:active {
    transform: translateY(0);
}

.results {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.results.hidden .result-card {
    opacity: 0.5;
    pointer-events: none;
}

.results.hidden .result-item {
    display: none;
}

.results.hidden .result-header {
    margin-bottom: 0;
}

.results.hidden .result-card::after {
    content: "Enter values and calculate to see results";
    display: block;
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px 20px;
    font-size: 0.9em;
}

.result-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    position: relative;
    min-height: 200px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.result-card h2 {
    color: #333;
    font-size: 1.3em;
    margin: 0;
    flex: 1;
    text-align: center;
}

.print-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 15px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.print-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    transition: transform 0.2s ease;
}

.result-item:hover {
    transform: translateX(5px);
}

.result-item.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left: 4px solid white;
    font-weight: 600;
}

.result-item.highlight .result-label,
.result-item.highlight .result-value {
    color: white;
}

.result-label {
    font-size: 0.9em;
    color: #333;
    font-weight: 500;
}

.result-value {
    font-size: 1em;
    color: #667eea;
    font-weight: 700;
}

.result-value.profit {
    color: #10b981;
}

.result-item.highlight .result-value.profit {
    color: white;
}

.input-details {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.input-details h3 {
    color: #333;
    font-size: 1.1em;
    margin-bottom: 12px;
    text-align: center;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.input-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.detail-label {
    font-size: 0.9em;
    color: #333;
    font-weight: 500;
}

.detail-value {
    font-size: 0.95em;
    color: #667eea;
    font-weight: 600;
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        gap: 15px;
    }

    .results-section {
        position: static;
    }

    #profitCalculator {
        grid-template-columns: 1fr;
    }

    .calculator-card {
        padding: 15px;
    }

    h1 {
        font-size: 1.5em;
    }

    .result-label {
        font-size: 0.85em;
    }

    .result-value {
        font-size: 0.95em;
    }

    .result-header {
        flex-direction: column;
        gap: 10px;
    }

    .print-btn {
        width: 100%;
        justify-content: center;
    }

    .result-card {
        min-height: auto;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        max-width: 100%;
    }

    .calculator-card {
        box-shadow: none;
        border: 1px solid #ddd;
        padding: 15px;
    }

    .calculate-btn,
    .add-other-btn,
    .print-btn,
    .remove-other-btn,
    form {
        display: none !important;
    }
    
    .input-section {
        display: none !important;
    }
    
    .print-section {
        display: block !important;
    }

    .results {
        display: block !important;
        margin-top: 0;
    }

    .result-card {
        background: white !important;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .result-item {
        page-break-inside: avoid;
        border-left: 2px solid #667eea;
    }

    .result-item.highlight {
        background: #f0f0f0 !important;
        color: #333 !important;
        border-left: 3px solid #667eea;
    }

    .result-item.highlight .result-label,
    .result-item.highlight .result-value {
        color: #333 !important;
    }

    .result-value.profit {
        color: #059669 !important;
    }

    h1, .subtitle {
        margin-bottom: 10px;
    }

    @page {
        margin: 1cm;
    }
}

