/* Miss-Woo Styles for Missive Iframe Integration */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: transparent; /* Changed to transparent for Missive */
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: transparent; /* Changed to transparent for Missive */
    min-height: 100vh;
}

/* Header - Simplified for Missive */
.app-header {
    background: #f8f9fa;
    color: #333;
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
    margin-bottom: 0.5rem;
}

.app-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.subtitle {
    display: none; /* Hidden in Missive for space efficiency */
}

/* Main Content */
.app-content {
    padding: 0.75rem;
}

/* Search Section */
.search-section {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.search-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.search-btn {
    padding: 0.5rem 1rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
}

.search-btn:hover {
    background: #5a6fd8;
}

/* Auto-Search Indicator */
.auto-search-indicator {
    background: #e8f5e8;
    color: #2d5a2d;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid #c3e6c3;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auto-search-indicator::before {
    content: "🔍";
    font-size: 1rem;
}

/* Customer Info Section */
.customer-info {
    background: #f8f9fa;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 4px;
    border: 1px solid #e1e5e9;
    font-size: 0.9rem;
}

.customer-field {
    color: #333;
    font-weight: 500;
}

.customer-field.mismatch {
    color: #dc3545;
    font-weight: 600;
}

/* Results Table - Optimized for Missive */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem; /* Smaller font for Missive */
    background: white;
    margin-top: 0.5rem;
}

th {
    background: #f8f9fa;
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #e1e5e9;
    white-space: nowrap;
}

td {
    padding: 0.5rem;
    border-bottom: 1px solid #e1e5e9;
    color: #495057;
}

/* Column Widths - Optimized for Missive */
th:nth-child(1), td:nth-child(1) { width: 20%; } /* Date */
th:nth-child(2), td:nth-child(2) { width: 20%; } /* Order # */
th:nth-child(3), td:nth-child(3) { width: 30%; } /* Serial # */
th:nth-child(4), td:nth-child(4) { width: 30%; } /* Tracking */

/* Table Row Interactions */
tr:hover {
    background: #f8f9fa;
}

/* Links in Table */
td a {
    color: #667eea;
    text-decoration: none;
    display: inline-block; /* Better touch targets */
    padding: 0.1rem 0;
}

td a:hover {
    text-decoration: underline;
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 1rem;
    color: #6c757d;
    font-size: 0.9rem;
}



.error {
    background: #f8d7da;
    color: #721c24;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    border: 1px solid #f5c6cb;
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

/* Responsive Design - Missive Specific */
@media (max-width: 600px) {
    /* Ensure table is scrollable */
    .results-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem; /* Negative margin to allow full-width scroll */
        padding: 0 0.75rem;
    }

    /* Keep table headers visible */
    th {
        position: sticky;
        top: 0;
        background: #f8f9fa;
        z-index: 1;
    }

    /* Adjust font sizes */
    table {
        font-size: 0.8rem;
    }

    /* Adjust padding */
    th, td {
        padding: 0.4rem;
    }

    /* Equal width columns on mobile */
    th:nth-child(1), td:nth-child(1),
    th:nth-child(2), td:nth-child(2),
    th:nth-child(3), td:nth-child(3),
    th:nth-child(4), td:nth-child(4) {
        width: auto;
        min-width: 100px; /* Ensure minimum width for readability */
    }
}

/* Dark Mode Support for Missive */
@media (prefers-color-scheme: dark) {
    body {
        color: #e1e5e9;
        background: transparent;
    }

    .app-header {
        background: #2d2d2d;
        color: #e1e5e9;
        border-bottom-color: #404040;
    }

    table {
        background: #2d2d2d;
    }

    th {
        background: #333;
        color: #e1e5e9;
        border-bottom-color: #404040;
    }

    td {
        border-bottom-color: #404040;
        color: #e1e5e9;
    }

    tr:hover {
        background: #333;
    }

    .search-input {
        background: #2d2d2d;
        border-color: #404040;
        color: #e1e5e9;
    }

    .search-input:focus {
        border-color: #667eea;
    }

    td a {
        color: #869eee;
    }

    .loading {
        color: #a0a0a0;
    }

    .error {
        background: #442326;
        color: #f8d7da;
        border-color: #721c24;
    }

    .auto-search-indicator {
        background: #1a3a1a;
        color: #c3e6c3;
        border-color: #2d5a2d;
    }
}

/* Loading animation */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-size: 18px;
  color: #333;
  font-weight: 500;
}

.loading-dots {
  display: inline-block;
  margin-left: 8px;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%, 100% {
    content: '...';
  }
}