/* Rimspec - Responsive Styles */

:root {
    --primary-color: #1a365d;
    --primary-hover: #2c5282;
    --secondary-color: #ed8936;
    --secondary-hover: #dd6b20;
    --danger-color: #e53e3e;
    --success-color: #38a169;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --text-color: #2d3748;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navbar {
    background: var(--primary-color);
    color: white;
    padding: 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.logo-icon {
    font-size: 1.8rem;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255, 255, 255, 0.2);
}

.nav-login {
    background: var(--secondary-color);
}

.nav-login:hover {
    background: var(--secondary-hover) !important;
}

.nav-logout {
    background: var(--danger-color);
}

/* Sub Navigation */
.subnav {
    background: var(--primary-hover);
    color: white;
    padding: 0 0 8px 0;
    box-shadow: var(--shadow);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.subnav-menu {
    display: flex;
    list-style: none;
    gap: 10px;
    height: 45px;
    align-items: center;
    flex-wrap: wrap;
}

.subnav-menu a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.subnav-menu a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.subnav-menu a.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-weight: 600;
}

/* Tertiary Navigation (3rd level) - lighter blue like subnav */
.tertiary-nav {
    background: #4a6fa5;  /* lighter blue than primary-hover */
    color: white;
    padding: 0 0 8px 0;
    box-shadow: var(--shadow);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tertiary-nav-menu {
    display: flex;
    list-style: none;
    gap: 10px;
    height: 40px;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    flex-wrap: wrap;
}

.tertiary-nav-menu a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.tertiary-nav-menu a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.tertiary-nav-menu a.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 20px;
}

.flash {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-success {
    background: #c6f6d5;
    color: #22543d;
}

.flash-danger {
    background: #fed7d7;
    color: #742a2a;
}

.flash-warning {
    background: #feebc8;
    color: #744210;
}

.flash-info {
    background: #bee3f8;
    color: #2a4365;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 5px;
    color: inherit;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2d3748 100%);
    color: white;
    padding: 80px 20px;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.hero-content {
    flex: 1;
    min-width: 300px;
    max-width: 600px;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 1.3rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-visual {
    flex: 0 0 200px;
}

.wheel-animation {
    font-size: 150px;
    animation: spin 4s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

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

.btn-danger:hover {
    background: #c53030;
}

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

.btn-large {
    padding: 16px 32px;
    font-size: 1.2rem;
}

.btn-full {
    width: 100%;
}

.btn-block {
    display: block;
    margin-bottom: 10px;
    text-align: center;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Sections */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
    color: var(--primary-color);
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.service-card:hover {
    transform: translateY(-5px);
}

.service-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.service-card h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* Locations Grid */
.locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.location-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.location-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.location-card p {
    margin-bottom: 8px;
    color: var(--text-muted);
}

/* CTA Section */
.cta {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 60px 20px;
    border-radius: 12px;
    margin: 40px 0;
}

.cta h2 {
    color: white;
    margin-bottom: 15px;
}

.cta p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 20px;
}

.auth-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-icon {
    font-size: 4rem;
    margin-bottom: 10px;
}

.auth-header h1 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.auth-header p {
    color: var(--text-muted);
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard {
    padding: 20px 0;
}

.dashboard-header {
    margin-bottom: 30px;
}

.dashboard-header h1 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.dashboard-card h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.profile-info p {
    margin-bottom: 12px;
}

.location-list {
    list-style: none;
}

.location-list li {
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 10px;
}

.stats-grid {
    display: flex;
    gap: 30px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Role Badges */
.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin {
    background: #fed7d7;
    color: #742a2a;
}

.role-manager {
    background: #feebc8;
    color: #744210;
}

.role-associate {
    background: #c6f6d5;
    color: #22543d;
}

.role-wheel_pro {
    background: #e9d8fd;
    color: #553c9a;
}

.role-wheel_tech {
    background: #d6f5d6;
    color: #276749;
}

.role-mechanic {
    background: #feebc8;
    color: #744210;
}

.role-bodywork_expert {
    background: #fed7e2;
    color: #97266d;
}

.role-production_manager {
    background: #bee3f8;
    color: #2a4365;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background: #c6f6d5;
    color: #22543d;
}

.status-inactive {
    background: #e2e8f0;
    color: #4a5568;
}

/* Lead Statuses */
.status-warm {
    background: #feebc8;
    color: #744210;
}

.status-cold {
    background: #bee3f8;
    color: #2a4365;
}

.status-sale {
    background: #c6f6d5;
    color: #22543d;
}

.status-dead {
    background: #fed7d7;
    color: #742a2a;
}

/* Status Guide */
.status-guide {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.status-item p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Lead Info */
.lead-info p {
    margin-bottom: 10px;
}

/* Admin Pages */
.admin-container {
    padding: 20px 0;
}

.admin-header {
    margin-bottom: 30px;
}

.admin-header h1 {
    color: var(--primary-color);
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(300px, 380px) 1fr;
    gap: 30px;
    align-items: start;
}

.admin-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    max-width: 100%;
}

.admin-card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: left;
    font-size: 1.3rem;
}

.admin-card-full {
    grid-column: 1 / -1;
}

/* Modern Form Styles */
.admin-card form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.form-row .form-group {
    min-width: 0;
}

/* Modern Input Styles */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-color);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="tel"]:hover,
input[type="date"]:hover,
input[type="datetime-local"]:hover,
input[type="number"]:hover,
select:hover,
textarea:hover {
    border-color: var(--primary-hover);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

/* Remove spinner buttons from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* Textarea specific */
textarea {
    resize: vertical;
    min-height: 80px;
}

input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

select:disabled,
input:disabled,
textarea:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.6;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.checkbox-label:hover {
    background: #e8edf2;
    border-color: var(--border-color);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.form-actions .btn {
    flex: 1;
}

/* Location Actions */
.location-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.location-actions form {
    margin: 0;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--primary-color);
}

/* Sortable column headers */
.sort-header {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.sort-header:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.sort-header.name,
.sort-header.phone,
.sort-header.type,
.sort-header.business,
.sort-header.location,
.sort-header.created {
    font-weight: 700;
}

.row-disabled {
    opacity: 0.6;
}

.location-tag,
.user-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-color);
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 2px;
}

.user-inactive {
    opacity: 0.5;
    text-decoration: line-through;
}

/* Locations Admin */
.locations-admin-list {
    display: grid;
    gap: 20px;
}

.location-admin-card {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.location-inactive {
    border-left-color: var(--text-muted);
}

.location-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.location-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.location-details p {
    margin-bottom: 5px;
    color: var(--text-muted);
}

.location-users {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.location-users h4 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.user-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Footer */
.footer {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Utilities */
.text-muted {
    color: var(--text-muted);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    
    .nav-menu {
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--primary-color);
        flex-direction: column;
        padding: 20px;
        gap: 10px;
        display: none;
    }
    
    .nav-menu.active {
        display: flex;
    }

    .subnav-menu {
        height: auto;
        flex-wrap: wrap;
        padding: 10px 0 15px 0;
        gap: 8px;
        justify-content: center;
    }

    .subnav-menu a {
        padding: 6px 14px;
        font-size: 0.85rem;
    }

    .tertiary-nav-menu {
        height: auto;
        flex-wrap: wrap;
        padding: 8px 15px 12px 15px;
        gap: 8px;
        justify-content: center;
    }

    .tertiary-nav-menu a {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    .hero {
        padding: 40px 20px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .wheel-animation {
        font-size: 100px;
    }
    
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        justify-content: center;
    }
    
    .services-grid,
    .locations-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 10px;
    }
    
    .auth-card {
        padding: 25px;
    }
    
    .dashboard-card,
    .admin-card,
    .service-card,
    .location-card {
        padding: 20px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="number"],
    select,
    textarea {
        padding: 12px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}
