:root {
    --primary-color: #4caf50;
    --primary-hover: #45a049;
    --text-dark: #333;
    --text-muted: #666;
    --border-color: #ddd;
    --bg-light: #f9f9f9;
    --bg-lighter: #f5f5f5;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --border-radius: 4px;
    --border-radius-lg: 8px;
}

/* Base Layout */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: var(--spacing-lg);
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    padding-bottom: 60px;
}

.hidden {
    display: none !important;
}

/* Common Section Styles */
.name-section,
.peer-section,
.chat-section,
.contract-section,
.profit-calculator {
    background: #ffffff;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-lg);
}

/* Form Elements */
input[type="text"],
input[type="number"] {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

button {
    padding: var(--spacing-sm) var(--spacing-lg);
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--primary-hover);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Form Groups */
.form-group {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    color: var(--text-muted);
}

/* Contract Section */
.contract-form,
.counter-offer-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.contract-display {
    background: var(--bg-lighter);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    margin-top: var(--spacing-sm);
}

/* Role Display */
.role-display {
    background: var(--primary-color);
    color: white;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    font-weight: bold;
    width: 100%;
    box-sizing: border-box;
}

/* Instructions Modal */
.instructions-section {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.instructions-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

/* Add this new style for the continue button */
#continueButton {
    display: block;
    margin: var(--spacing-lg) auto 0;
    min-width: 120px;
}

/* Video Elements */
.video-container {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

#localVideo,
#remoteVideo {
    width: 100%; /* Full width by default */
    min-width: 240px; /* Minimum width */
    max-width: 320px; /* Maximum width */
    height: 180px; /* 16:9 aspect ratio based on max-width */
    border-radius: var(--border-radius-lg);
    background-color: #000;
    object-fit: cover;
}

/* When container is wide enough, videos will display side by side */
@media (min-width: 660px) {
    /* 2 * max-width + gap + padding */
    #localVideo,
    #remoteVideo {
        width: calc(50% - var(--spacing-sm));
    }
}

#localVideo {
    transform: scaleX(-1);
}

/* Collapsible Sections */
.calculator-form,
.contract-form {
    transition: max-height 0.3s ease-out;
    max-height: 1000px;
    overflow: hidden;
}

/* Results Display */
.results-display {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--bg-light);
    border-radius: var(--border-radius);
}

.profit-result {
    margin-bottom: var(--spacing-sm);
}

.profit-result span {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-color);
}

/* Contract Terms Layout */
.form-group.contract-inputs {
    flex-direction: row;
    gap: var(--spacing-md);
}

.form-group.contract-inputs .input-group {
    flex: 1;
    min-width: 0; /* Prevents flex items from overflowing */
}

.form-group.contract-inputs input {
    width: 100%;
}

/* Contract and Video Layout */
.contract-chat-container {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.contract-section {
    flex: 1;
    margin-bottom: 0; /* Override the default margin since we're using gap */
}

.chat-section {
    flex: 1;
}

.video-container {
    margin-bottom: 0; /* Override the default margin since we're using gap */
}

/* Floating Instructions Button */
#showInstructions {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--primary-color);
    box-shadow: var(--shadow);
}

/* Name and Peer Input Sections */
.name-section,
.peer-section {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.name-section input,
.peer-section input {
    flex: 1;
    margin: 0;
}

.name-section button,
.peer-section button {
    white-space: nowrap;
}

/* Add these styles for the floating calculator button */
#showCalculator {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 999;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--primary-color);
    box-shadow: var(--shadow);
}

/* Update the profit calculator section */
#profitCalculatorSection {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    margin-top: var(--spacing-lg);
}

/* Keep the existing calculator styles */
.calculator-form {
    transition: max-height 0.3s ease-out;
    max-height: 1000px;
    overflow: hidden;
}

/* Calculator Modal */
.calculator-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.calculator-modal .profit-calculator {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.calculator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.calculator-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-dark);
    cursor: pointer;
    padding: 0 var(--spacing-sm);
}

.calculator-close:hover {
    color: var(--primary-color);
}

/* Keep the floating button styles */
#showCalculator {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 999;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--primary-color);
    box-shadow: var(--shadow);
}

/* Center align calculator buttons */
#calculateProfits {
    display: block;
    margin: var(--spacing-lg) auto;
    min-width: 120px;
}
.license-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #666;
    color: white;
    padding: 0px;
    text-align: center;
    z-index: 500;
}

.license-footer a {
    color: #fff;
    text-decoration: underline;
}

.license-footer a:hover {
    color: #ddd;
}
