/* Hill-Fi Tech Portal Styles */
/* Mobile-First Design */

:root {
    --primary-color: #0ea5e9;
    --primary-dark: #0284c7;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    flex-grow: 1;
    text-align: center;
}

.logo-small {
    height: 40px;
    width: auto;
}

.back-button {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem;
    margin: -0.5rem;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Main Content */
.main-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    height: 80px;
    width: auto;
    margin-bottom: 1rem;
}

.logo-container h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Landing Page */
.welcome-section {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
}

.welcome-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.welcome-section p {
    color: var(--text-secondary);
}

.module-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.module-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
    border: 2px solid transparent;
}

.module-card:active {
    transform: scale(0.98);
}

.module-card:not(.module-disabled):hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.module-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.module-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.module-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.module-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Forms */
.login-form,
.installation-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-section {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.form-section h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

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

select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
}

.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Radio Buttons */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s, background-color 0.2s;
}

.radio-label:active {
    transform: scale(0.99);
}

.radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.radio-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 0.75rem;
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.radio-label input[type="radio"]:checked ~ .radio-custom {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

.radio-label input[type="radio"]:checked ~ .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--white);
}

.radio-label input[type="radio"]:checked ~ .radio-text strong {
    color: var(--primary-color);
}

.radio-text {
    display: flex;
    flex-direction: column;
}

.radio-text strong {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.radio-text small {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: normal;
}

/* Checkboxes */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s;
    margin-bottom: 0.75rem;
}

.checkbox-label:last-child {
    margin-bottom: 0;
}

.checkbox-label:active {
    transform: scale(0.99);
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin-right: 0.75rem;
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.2s, background-color 0.2s;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-custom {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-custom::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 7px;
    width: 6px;
    height: 12px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-text {
    display: flex;
    flex-direction: column;
}

.checkbox-text strong {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.checkbox-text small {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: normal;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-primary:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

.btn-large {
    width: 100%;
    padding: 1.125rem;
    font-size: 1.125rem;
    min-height: 56px;
}

.btn-loading {
    display: none;
}

.btn:disabled .btn-text {
    display: none;
}

.btn:disabled .btn-loading {
    display: inline;
}

.form-actions {
    margin-top: 1rem;
}

/* Error Messages */
.error-message {
    background-color: #fee;
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 0.875rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.error-banner {
    background-color: #fee;
    border: 2px solid var(--error-color);
    color: var(--error-color);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.error-banner strong {
    display: block;
    margin-bottom: 0.5rem;
}

.error-banner p {
    font-size: 0.875rem;
    margin: 0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.success-icon {
    width: 80px;
    height: 80px;
    background-color: var(--success-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1.5rem;
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.modal-content #customerNameDisplay {
    color: var(--text-primary);
    font-weight: 600;
}

.modal-content button {
    margin-top: 1.5rem;
}

#successDetails,
#errorDetails {
    text-align: left;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
}

#successDetails p,
#errorDetails p {
    margin: 0.5rem 0;
    color: var(--text-primary);
}

/* Choices.js Customization (for searchable dropdowns) */
.choices__inner {
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    min-height: 50px;
    font-size: 1rem;
}

.choices__list--dropdown {
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    margin-top: 0.25rem;
}

.choices__item--selectable {
    padding: 0.75rem;
}

.is-focused .choices__inner {
    border-color: var(--primary-color);
}

/* Responsive Design */
@media (min-width: 768px) {
    .main-content {
        padding: 2rem 1rem;
    }
    
    .form-section {
        padding: 2rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .module-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .module-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Google Places Autocomplete Styles */
.pac-container {
    font-family: inherit;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
    box-shadow: var(--shadow-lg);
    margin-top: 4px;
    z-index: 10000;
}

.pac-item {
    padding: 12px;
    font-size: 1rem;
    border-top: 1px solid var(--border-color);
    cursor: pointer;
}

.pac-item:first-child {
    border-top: none;
}

/* Google Places Web Component Styles */
/* Use Google's CSS custom properties for styling */
gmp-place-autocomplete {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    
    /* Google Places CSS custom properties */
    --gmp-place-autocomplete-background-color: #ffffff;
    --gmp-place-autocomplete-text-color: #1f2937;
    --gmp-place-autocomplete-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --gmp-place-autocomplete-font-size: 1rem;
    --gmp-place-autocomplete-border-color: #e5e7eb;
    --gmp-place-autocomplete-border-width: 2px;
    --gmp-place-autocomplete-border-radius: 8px;
    --gmp-place-autocomplete-padding: 0.875rem;
    
    /* Additional container styling */
    background-color: #ffffff !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 0.875rem !important;
    min-height: 52px !important;
}

gmp-place-autocomplete:focus-within {
    border-color: #0ea5e9 !important;
    outline: none !important;
    --gmp-place-autocomplete-border-color: #0ea5e9;
}

.pac-item:hover {
    background-color: var(--bg-light);
}

.pac-item-query {
    font-weight: 600;
    color: var(--text-primary);
}

.pac-matched {
    font-weight: 700;
    color: var(--primary-color);
}

.pac-icon {
    display: none;
}

/* Router Setup Specific Styles */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ocr-status {
    text-align: center;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-top: 16px;
}

.error-icon {
    width: 80px;
    height: 80px;
    background-color: var(--error-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--white);
    margin: 0 auto 1rem;
}

/* Toast Notifications */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}
