/* ==========================================
   styles.css - The Stylist
   Controls all layout, colors, animations, and visual formatting.
========================================== */

:root {
    --primary-color: #2c3e50;
    --accent-color: #e74c3c;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

h2 { text-align: center; color: var(--primary-color); margin-bottom: 30px; }

/* Settings Section */
.settings-panel {
    background-color: #ecf0f1;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 25px;
    border: 1px solid #bdc3c7;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

/* Row Styling */
.tyre-row {
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 20px;
    position: relative;
}

.input-group {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr auto; /* Added 'auto' for delete button */
    gap: 15px;
    align-items: start;
}
        
.btn-delete {
    background-color: #e74c3c;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}
        
.btn-delete:hover {
    background-color: #c0392b;
}

label {
    display: block;
    font-size: 0.85em;
    font-weight: bold;
    color: #7f8c8d;
    margin-bottom: 5px;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
    background-color: white;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.helper-text {
    color: var(--accent-color);
    font-size: 0.9em;
    margin-top: 5px;
    font-weight: 600;
    min-height: 1.2em;
}

/* Autocomplete List Styling */
.autocomplete-wrapper { position: relative; }

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.suggestions-list li {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
}

.suggestions-list li:hover { background-color: #f9f9f9; }

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: flex-end;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background 0.2s;
}

/* Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.5); 
}
.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    
    /* CENTERING MAGIC */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0; /* Remove old margins */
    
    /* SCROLLING LOGIC */
    max-height: 90vh; /* Max height is 90% of screen */
    overflow-y: auto; /* Scrollbar appears inside if content is too long */
}

.modal h3 { margin-top: 0; color: var(--primary-color); }
.form-group { margin-bottom: 15px; }
.form-group input { width: 100%; padding: 8px; box-sizing: border-box; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-cancel { background-color: #95a5a6; color: white; }
.btn-save { background-color: #27ae60; color: white; }

.btn-add { background-color: #3498db; color: white; }
.btn-add:hover { background-color: #2980b9; }

.btn-gen { background-color: #27ae60; color: white; }
.btn-gen:hover { background-color: #219150; }

/* --- Custom Toast Notification (Replaces Alerts) --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background-color: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 4px;
    margin-bottom: 10px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error { background-color: #e74c3c; }
.toast.success { background-color: #27ae60; }

/* --- Fix Dropdown Z-Index in Modal --- */
/* Fix Dropdown in Modal */
.modal .suggestions-list {
    z-index: 1500; 
    border: 1px solid #bdc3c7;
    max-height: 180px; /* Slightly taller */
    background: white;
    width: 100%; /* Match input width */
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}


/* ==========================================
   MOBILE RESPONSIVENESS
========================================== */
@media screen and (max-width: 768px) {
    /* 1. Stack the top settings panel vertically */
    .settings-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* 2. Stack the tyre entry rows vertically for easy tapping */
    .input-group {
        grid-template-columns: 1fr !important;
        background: #fbfbfc;
        padding: 15px;
        border-radius: 8px;
        border: 1px solid #ecf0f1;
    }
    
    /* 3. Make delete button full width on mobile */
    .btn-delete {
        width: 100%;
        margin-top: 10px;
    }
    
    /* 4. Make bottom action buttons stack vertically */
    .button-group {
        flex-direction: column;
    }
    .button-group button {
        width: 100%;
    }

    /* 5. Fix the modal (Add New Customer) from bleeding off screen */
    .modal-content {
        width: 90% !important;
        padding: 20px;
    }

    /* 6. Allow the Load Quotation bar to wrap naturally */
    div[style*="margin-bottom: 20px; display: flex;"] {
        flex-wrap: wrap;
    }
}
