/*
    Unified CSS for User, Driver, and Garage Registration Forms
    This file combines and corrects the styles to ensure a consistent look
    and feel across all registration types.
*/

/* ========== Global Variables and Resets ========== */
:root {
    --primary: #2ecc71;
    --dark: #111111;
    --light: #ffffff;
    --gray: #7f8c8d;
    --error-bg: #f8d7da;
    --error-border: #721c24;
    --error-text: #721c24;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Inter", sans-serif;
}

html, body {
    height: 100%;
    width: 100%;
    /* Prevents horizontal overflow, which is a key issue. */
    overflow-x: hidden;
}

/* ========== Main Container & Layout ========== */
.register-container {
    display: flex;
    /* Use min-height for flexible content, allowing form to grow. */
    min-height: 100vh;
    width: 100%;
    background-color: #fff;
}

/* Left Info Panel */
.register-info {
    flex: 0 0 40%;
    background-color: var(--dark);
    color: var(--light);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    position: relative;
}

.info-content h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 15px;
}

.info-content h1 .icon {
    color: var(--primary);
}

.info-content p {
    font-size: 16px;
    line-height: 1.5;
    max-width: 350px;
    color: var(--gray);
}

/* Right Form Panel - FIXED OVERFLOW */
.register-form-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 20px;
    /* This is critical for scrolling on taller forms (like Garage). */
    overflow-y: auto;
    max-height: 100vh;
}

.form-wrapper {
    width: 100%;
    max-width: 550px;
    padding: 20px 0;
}

.form-header {
    margin-bottom: 25px;
}

.form-header h1 {
    font-size: 28px;
    color: var(--dark);
    margin-bottom: 8px;
}

.form-header p {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 0;
}

/* ========== INPUT STYLES ========== */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--dark);
    font-size: 14px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    font-size: 14px;
    z-index: 1;
}

.input-wrapper .toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    cursor: pointer;
    font-size: 14px;
    z-index: 1;
}

.input-wrapper input,
.input-wrapper select,
.input-wrapper textarea {
    width: 100%;
    /* Unified padding for all input types for consistency. */
    padding: 12px 40px 12px 40px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
    background: #fff;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.input-wrapper select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.input-wrapper textarea {
    /* Special padding and resize for the textarea. */
    padding: 12px;
    resize: vertical;
    min-height: 80px;
    appearance: none;
}

#password, #confirm_password {
    padding-right: 40px !important;
}

.input-wrapper input:focus,
.input-wrapper select:focus,
.input-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
}

/* ========== BUTTON STYLES ========== */
.register-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.register-btn:hover {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

/* ========== LINK STYLES ========== */
.login-link {
    text-align: center;
    margin-top: 20px;
    color: var(--gray);
    font-size: 14px;
}

.login-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* ========== MESSAGE STYLES ========== */
.error-message {
    background: var(--error-bg);
    padding: 12px;
    margin: 15px 0;
    border-left: 4px solid var(--error-border);
    color: var(--error-text);
    font-weight: bold;
    border-radius: 4px;
    font-size: 14px;
}

.success-message {
    background: #d4edda;
    padding: 12px;
    margin: 15px 0;
    border-left: 4px solid #28a745;
    color: #155724;
    font-weight: bold;
    border-radius: 4px;
    font-size: 14px;
}

/* ========== PASSWORD STRENGTH ========== */
.password-strength {
    margin-top: 6px;
    height: 4px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0;
    background-color: #e74c3c;
    transition: width 0.3s, background-color 0.3s;
}

/* ========== Grid layout for form fields ========== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1200px) {
    .register-info {
        flex: 0 0 35%;
        padding: 30px;
    }
    
    .form-wrapper {
        max-width: 500px;
    }
}

@media (max-width: 992px) {
    .register-container {
        flex-direction: column;
        min-height: auto;
    }
    
    .register-info {
        flex: none;
        padding: 40px 20px;
        min-height: 200px;
    }
    
    .register-form-section {
        padding: 30px 20px;
        align-items: center;
        max-height: none;
    }
    
    .form-wrapper {
        max-width: 500px;
    }
    
    .info-content h1 {
        font-size: 32px;
    }
}

@media (max-width: 768px) {
    .form-grid,
    .form-grid-3 {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .register-form-section {
        padding: 20px 15px;
    }
    
    .form-wrapper {
        max-width: 100%;
    }
    
    .form-header h1 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .register-info {
        padding: 30px 15px;
    }
    
    .register-form-section {
        padding: 15px 10px;
    }
    
    .info-content h1 {
        font-size: 28px;
    }
    
    .input-wrapper input,
    .input-wrapper select,
    .input-wrapper textarea {
        padding: 10px 35px 10px 35px;
    }
}
