/* ============================================================================
   M&M GARAGE DOORS - PARTS VERIFICATION AI
   Professional styling with M&M brand colors
   ============================================================================ */

:root {
    --mm-primary: #228B22;      /* M&M Green - Primary Brand Color */
    --mm-secondary: #333333;    /* Dark Gray */
    --mm-accent: #FFD700;       /* M&M Gold - Accent Color */
    --mm-light: #F5F5F5;        /* Light background */
    --mm-border: #E0E0E0;       /* Border color */
    --success: #27AE60;
    --warning: #F39C12;
    --error: #E74C3C;
    --info: #3498DB;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--mm-light);
    color: var(--mm-secondary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */

.navbar {
    background: var(--mm-primary);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.3rem;
    font-weight: bold;
}

.logo {
    height: 40px;
    width: auto;
}

.brand-text {
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.nav-menu {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.logout-btn {
    background: rgba(255,100,100,0.3) !important;
    border-color: rgba(255,100,100,0.5) !important;
}

.logout-btn:hover {
    background: rgba(255,100,100,0.5) !important;
}

.nav-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: white;
    color: var(--mm-primary);
    font-weight: bold;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

.main {
    padding: 40px 20px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

h1 {
    font-size: 2.5rem;
    color: var(--mm-primary);
    margin-bottom: 10px;
}

h2 {
    font-size: 2rem;
    color: var(--mm-primary);
    margin-bottom: 30px;
    border-bottom: 3px solid var(--mm-accent);
    padding-bottom: 15px;
}

h3 {
    font-size: 1.3rem;
    color: var(--mm-secondary);
    margin-bottom: 15px;
}

h4 {
    font-size: 1rem;
    color: var(--mm-secondary);
    margin-bottom: 10px;
}

/* ============================================================================
   DASHBOARD
   ============================================================================ */

.dashboard-hero {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, rgba(204,0,0,0.1) 0%, rgba(255,184,28,0.1) 100%);
    border-radius: 10px;
    margin-bottom: 40px;
}

.dashboard-hero p {
    font-size: 1.3rem;
    color: #666;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(204,0,0,0.1);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content h3 {
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #999;
    text-transform: uppercase;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--mm-primary);
}

.quick-start {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--mm-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(34,139,34,0.3);
    opacity: 0.9;
}

.btn-secondary {
    background: white;
    color: var(--mm-primary);
    border: 2px solid var(--mm-primary);
}

.btn-secondary:hover {
    background: var(--mm-primary);
    color: white;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
    width: 100%;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ============================================================================
   FORMS
   ============================================================================ */

.training-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .training-container {
        grid-template-columns: 1fr;
    }
}

.training-steps,
.training-form,
.verify-container,
.bulk-container,
.manage-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.step {
    padding: 15px;
    background: var(--mm-light);
    border-left: 4px solid var(--mm-accent);
    border-radius: 4px;
}

.step h4 {
    color: var(--mm-primary);
    margin-bottom: 8px;
}

.step p {
    font-size: 0.9rem;
    color: #666;
}

.step ul {
    margin-left: 20px;
    margin-top: 8px;
    font-size: 0.9rem;
}

.form-section {
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--mm-secondary);
}

input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--mm-border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--mm-primary);
    box-shadow: 0 0 0 3px rgba(204,0,0,0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ============================================================================
   UPLOAD BOXES
   ============================================================================ */

.upload-box {
    display: block;
    padding: 40px 20px;
    border: 3px dashed var(--mm-primary);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.upload-box:hover {
    border-color: var(--mm-accent);
    background: rgba(255,184,28,0.05);
}

.upload-icon {
    font-size: 3rem;
    color: var(--mm-primary);
    margin-bottom: 15px;
}

.upload-text {
    font-weight: 600;
    color: var(--mm-primary);
    margin-bottom: 5px;
}

.upload-subtext {
    font-size: 0.9rem;
    color: #999;
}

.bulk-upload {
    padding: 60px 20px;
}

/* ============================================================================
   IMAGE PREVIEW
   ============================================================================ */

.image-preview {
    position: relative;
    margin-top: 15px;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.image-preview .btn-small {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

/* Multi-image preview container */
.image-preview-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.preview-image-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.preview-image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.preview-image-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255,0,0,0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    padding: 0;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.preview-image-item .remove-btn:hover {
    background: rgba(255,0,0,1);
}

/* ============================================================================
   RESULTS SECTION
   ============================================================================ */

.results-section {
    margin-top: 30px;
    padding: 20px;
    background: var(--mm-light);
    border-radius: 8px;
}

.results-table {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 25px;
    background: var(--mm-border);
    border-radius: 12px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mm-primary) 0%, var(--mm-accent) 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
}

.parts-list,
.predictions-list {
    list-style: none;
}

.parts-list li,
.predictions-list li {
    padding: 12px;
    background: white;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 4px solid var(--mm-primary);
}

.predictions-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.confidence-score {
    font-weight: bold;
    color: var(--mm-primary);
    font-size: 1.2rem;
}

/* ============================================================================
   FILE LIST
   ============================================================================ */

.file-list {
    margin-top: 20px;
}

.file-list ul {
    list-style: none;
}

.file-list li {
    padding: 10px;
    background: var(--mm-light);
    margin-bottom: 8px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-list .remove-btn {
    background: var(--error);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

/* ============================================================================
   PARTS GRID
   ============================================================================ */

.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.part-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.part-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(204,0,0,0.15);
}

.part-card h4 {
    color: var(--mm-primary);
}

.part-info {
    margin-top: 12px;
    font-size: 0.9rem;
}

.part-info p {
    margin-bottom: 6px;
    color: #666;
}

.part-meta {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--mm-border);
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #999;
}

/* ============================================================================
   STATUS MESSAGES
   ============================================================================ */

.status-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-message.success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.status-message.error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--error);
    border-left: 4px solid var(--error);
}

.status-message.info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info);
    border-left: 4px solid var(--info);
}

.status-message.warning {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}

.status-icon {
    font-size: 1.2rem;
}

/* ============================================================================
   MODAL
   ============================================================================ */

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: var(--mm-primary);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer {
    background: var(--mm-secondary);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 50px;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .nav-menu {
        flex-direction: column;
        gap: 5px;
    }

    .training-form,
    .verify-container {
        width: 100%;
    }

    .button-group {
        flex-direction: column;
    }

    .btn-large {
        width: 100%;
    }

    .main {
        padding: 20px 10px;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.manage-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.bulk-info {
    background: var(--mm-light);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid var(--mm-accent);
}

.progress-section {
    margin-top: 20px;
}

.invoice-parts {
    margin: 25px 0;
}

/* ============================================================================
   TRAINING STEPS STYLING
   ============================================================================ */

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.step-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--mm-primary);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--mm-primary);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    flex-shrink: 0;
}

.step-info h4 {
    color: var(--mm-primary);
    margin-bottom: 5px;
}

.step-info p {
    font-size: 0.9rem;
    color: var(--mm-secondary);
}

/* ============================================================================
   STATUS MESSAGES
   ============================================================================ */

.status-message {
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    display: none;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================================================
   RESULTS DISPLAY
   ============================================================================ */

.results-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--mm-border);
}

.results-table {
    margin-top: 15px;
}

.results-table h4 {
    color: var(--mm-primary);
    margin-bottom: 10px;
}

.parts-list, .predictions-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.found-item {
    padding: 10px;
    background: #f0f9ff;
    border-left: 4px solid var(--success);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.found-item i {
    color: var(--success);
}

.prediction-item {
    padding: 12px;
    background: white;
    border: 1px solid var(--mm-border);
    border-radius: 4px;
}

.prediction-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--mm-secondary);
}

.prediction-confidence {
    display: flex;
    align-items: center;
    gap: 10px;
}

.prediction-confidence span {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--mm-primary);
    min-width: 45px;
}

.confidence-bar {
    height: 6px;
    background: var(--mm-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.no-items {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* ============================================================================
   FILE LIST STYLING
   ============================================================================ */

.file-list {
    margin-top: 20px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--mm-border);
}

.file-list ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--mm-light);
    border-radius: 4px;
}

.success-item {
    border-left: 4px solid var(--success);
}

.success-item i {
    color: var(--success);
}

.error-item {
    border-left: 4px solid var(--error);
}

.error-item i {
    color: var(--error);
}

/* ============================================================================
   PROGRESS BAR
   ============================================================================ */

.progress-bar {
    height: 24px;
    background: var(--mm-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mm-primary), var(--mm-accent));
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
    font-weight: bold;
}

/* ============================================================================
   PARTS GRID & CARDS
   ============================================================================ */

.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.part-card {
    background: white;
    border: 1px solid var(--mm-border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.part-card:hover {
    box-shadow: 0 4px 12px rgba(34, 139, 34, 0.15);
    transform: translateY(-2px);
}

.part-header {
    padding: 15px;
    background: linear-gradient(135deg, var(--mm-primary) 0%, #1a6b1a 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.part-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: white;
}

.part-category {
    background: var(--mm-accent);
    color: var(--mm-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

.part-body {
    padding: 15px;
    flex-grow: 1;
}

.part-body p {
    margin: 8px 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.part-body strong {
    color: var(--mm-primary);
}

.part-footer {
    padding: 10px 15px;
    background: var(--mm-light);
    border-top: 1px solid var(--mm-border);
    font-size: 0.85rem;
    color: #999;
}

.part-actions {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    border-top: 1px solid var(--mm-border);
    background: #fafafa;
}

.btn-action {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-edit {
    background: var(--info);
    color: white;
}

.btn-edit:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-delete {
    background: var(--error);
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* ============================================================================
   MODAL STYLING
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    padding: 30px;
    border: 1px solid var(--mm-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--mm-primary);
}

.modal-content h2 {
    color: var(--mm-primary);
    margin-bottom: 10px;
}

.modal-content p {
    color: #666;
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons .btn {
    flex: 1;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 768px) {
    .training-container {
        grid-template-columns: 1fr;
    }

    .parts-grid {
        grid-template-columns: 1fr;
    }

    .step-item {
        flex-direction: column;
        text-align: center;
    }

    .step-number {
        width: 50px;
        height: 50px;
        margin: 0 auto;
    }

    .nav-menu {
        flex-direction: column;
        gap: 5px;
    }

    .nav-btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}
