/* Base styles */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a1a 100%);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: #ecf0f1;
}

.fixed-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 80px;
    backgr.rio-card-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Job Name Field Styling */
.job-name-field {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f0f8ff;
    border: 2px solid #1976d2;
    border-radius: 8px;
}

.job-name-field label {
    font-size: 16px;
    font-weight: 700;
    color: #1976d2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rio-job-name {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #1976d2;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    background-color: white;
    color: #333;
}

.rio-job-name:focus {
    outline: none;
    border-color: #0d47a1;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.2);
    background-color: #fafafa;
}

.fixed-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    display: flex;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
}

.logo-placeholder {
    margin-left: 40px;
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 3px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-decoration: none;
}

.main-content {
    padding-top: 100px;
    padding-left: 40px;
    padding-right: 40px;
    min-height: calc(100vh - 80px);
}

/* Sales page specific styles */
.sales-header {
    padding: 24px 0 16px 0;
    border-bottom: 1px solid #e1e8ed;
    margin-bottom: 24px;
}

.sales-title {
    font-size: 2rem;
    font-weight: 700;
    color: #3498db;
    margin-bottom: 8px;
}

.sales-layout {
    display: flex;
    gap: 32px;
}

.sales-sidebar {
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-right: 16px;
}

.sales-sidebar .sidebar-btn {
    background: #f8f9fa;
    color: #3498db;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-align: left;
}

.sales-sidebar .sidebar-btn.active,
.sales-sidebar .sidebar-btn:hover {
    background: #3498db;
    color: #fff;
}

.sales-viewport {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(44,62,80,0.06);
    padding: 32px;
    min-height: 400px;
}

.sales-section {
    display: block;
}

.sales-section h2 {
    color: #2c3e50;
    margin-bottom: 16px;
    font-size: 1.5rem;
}

.sales-section p {
    color: #7f8c8d;
    line-height: 1.6;
}

/* RIO Card Styles */
.rio-cards-container {
    margin-bottom: 20px;
}

.rio-card {
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
}

.rio-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.rio-card-header {
    display: flex;
    justify-content: between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e1e8ed;
    background: #f8f9fa;
}

.rio-card-title {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
    flex: 1;
}

.rio-card-actions {
    display: flex;
    gap: 8px;
}

.rio-card-body {
    padding: 16px;
}

.rio-card-field {
    margin-bottom: 12px;
}

.rio-card-field label {
    display: block;
    font-weight: 600;
    color: #7f8c8d;
    margin-bottom: 4px;
}

/* Simple form styling - no conflicts */
.rio-card input,
.rio-card select,
.rio-card textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background-color: #fff;
    color: #333;
    box-sizing: border-box;
    outline: none;
}

.rio-card input:focus,
.rio-card select:focus,
.rio-card textarea:focus {
    border-color: #3498db !important;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2) !important;
    outline: none !important;
}

/* Specifically ensure no red border on shingle color input */
.rio-shingle-color,
.rio-shingle-color:focus,
.rio-shingle-color:invalid {
    border: 1px solid #ddd !important;
    outline: none !important;
}

.rio-shingle-color:focus {
    border-color: #3498db !important;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2) !important;
}

.rio-card textarea {
    min-height: 60px;
    resize: vertical;
}

/* ContentEditable title */
.rio-card-title[contenteditable="true"] {
    outline: none;
    border: 1px solid transparent;
    padding: 4px;
    border-radius: 4px;
    display: inline-block;
    min-width: 200px;
}

.rio-card-title[contenteditable="true"]:hover {
    background-color: rgba(248, 249, 250, 0.8);
    border-color: #dee2e6;
}

.rio-card-title[contenteditable="true"]:focus {
    background-color: #fff;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.rio-card-footer {
    padding: 16px;
    border-top: 1px solid #e1e8ed;
    background: #f8f9fa;
}

.add-rio-btn, .edit-btn, .delete-btn, .save-btn, .print-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    font-size: 14px;
    margin: 4px;
}

.add-rio-btn, .save-btn {
    background: #3498db;
    color: white;
}

.add-rio-btn:hover, .save-btn:hover {
    background: #2980b9;
}

.edit-btn {
    background: #f39c12;
    color: white;
}

.edit-btn:hover {
    background: #e67e22;
}

.delete-btn {
    background: #e74c3c;
    color: white;
}

.delete-btn:hover {
    background: #c0392b;
}

.print-btn {
    background: #27ae60;
    color: white;
}

.print-btn:hover {
    background: #229954;
}

@media (max-width: 900px) {
    .sales-layout {
        flex-direction: column;
    }
    .sales-sidebar {
        flex-direction: row;
        margin-bottom: 16px;
        margin-right: 0;
    }
    .sales-viewport {
        padding: 16px;
    }
}

/* Upgrades Section Styling */
.upgrades-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.upgrades-section h4 {
    margin: 0 0 15px 0;
    color: #2c5530;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #2c5530;
}

.upgrade-field {
    margin-bottom: 12px;
}

.upgrade-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.upgrade-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.upgrade-quantity {
    width: 120px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.upgrade-quantity:focus {
    outline: none;
    border-color: #2c5530;
    box-shadow: 0 0 0 2px rgba(44, 85, 48, 0.1);
}

.upgrade-rate {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.upgrade-total {
    font-weight: bold;
    color: #2c5530;
    font-size: 14px;
    min-width: 70px;
    text-align: right;
}

.grand-total-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #2c5530;
}

.grand-total-row {
    text-align: center;
    font-size: 16px;
    color: #2c5530;
}

.grand-total-row strong {
    font-size: 18px;
}

/* Currency formatting for total input */
.rio-total {
    font-weight: bold;
    color: #2c5530;
}

/* Shingle Upgrade Section Styling */
.shingle-upgrade-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f0f8f0;
    border: 1px solid #d4e6d4;
    border-radius: 8px;
}

.shingle-upgrade-section h4 {
    margin: 0 0 15px 0;
    color: #2c5530;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #2c5530;
}

.shingle-type-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

.shingle-type-select:focus {
    outline: none;
    border-color: #2c5530;
    box-shadow: 0 0 0 2px rgba(44, 85, 48, 0.1);
}

.shingle-calculation-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.roof-squares-input {
    width: 140px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.roof-squares-input:focus {
    outline: none;
    border-color: #2c5530;
    box-shadow: 0 0 0 2px rgba(44, 85, 48, 0.1);
}

.shingle-total {
    font-weight: bold;
    color: #2c5530;
    font-size: 15px;
}

/* Signature Section Styling */
.signature-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff8e1;
    border: 1px solid #ffcc02;
    border-radius: 8px;
}

.signature-section h4 {
    margin: 0 0 15px 0;
    color: #e65100;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e65100;
}

.signature-field {
    margin-bottom: 15px;
}

.signature-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.signature-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.signature-preview {
    flex: 1;
    min-width: 200px;
    min-height: 50px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.signature-placeholder {
    color: #999;
    font-style: italic;
    font-size: 14px;
}

.signature-preview img {
    max-height: 50px;
    max-width: 100%;
    border: 1px solid #ddd;
}

/* Signature Modal Styles */
.signature-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.signature-modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90%;
    overflow: hidden;
}

.signature-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
    background-color: #f8f9fa;
}

.signature-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.signature-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.signature-modal-close:hover {
    background-color: #f0f0f0;
}

.signature-modal-body {
    padding: 20px;
}

#signature-pad {
    border: 2px solid #ddd;
    border-radius: 4px;
    width: 100%;
    height: 200px;
    cursor: crosshair;
}

.signature-controls {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.signature-clear-btn, .signature-save-btn, .signature-cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.signature-clear-btn {
    background-color: #6c757d;
    color: white;
}

.signature-clear-btn:hover {
    background-color: #5a6268;
}

.signature-save-btn {
    background-color: #28a745;
    color: white;
}

.signature-save-btn:hover {
    background-color: #218838;
}

.signature-cancel-btn {
    background-color: #dc3545;
    color: white;
}

.signature-cancel-btn:hover {
    background-color: #c82333;
}

.sign-button {
    padding: 8px 16px;
    border: 1px solid #e65100;
    border-radius: 4px;
    background-color: #ff9800;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    white-space: nowrap;
}

.sign-button:hover {
    background-color: #f57c00;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sign-button.signed {
    background-color: #4caf50;
    border-color: #4caf50;
    cursor: default;
}

.sign-button.signed:hover {
    background-color: #4caf50;
    transform: none;
    box-shadow: none;
}

.signature-date {
    font-size: 12px;
    color: #666;
    font-style: italic;
    white-space: nowrap;
}

/* PDF Generation Section */
.pdf-generation-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ffcc02;
    text-align: center;
}

.generate-pdf-btn {
    padding: 12px 24px;
    border: 2px solid #d32f2f;
    border-radius: 6px;
    background-color: #f44336;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.generate-pdf-btn:hover {
    background-color: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.generate-pdf-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Responsive adjustments for signature section */
@media (max-width: 768px) {
    .signature-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .signature-input {
        min-width: unset;
    }
    
    .sign-button, .signature-date {
        text-align: center;
    }
}

/* Responsive adjustments for upgrade section */
@media (max-width: 768px) {
    .upgrade-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .upgrade-quantity {
        width: 100%;
    }
    
    .upgrade-rate, .upgrade-total {
        font-size: 13px;
    }
}