/* Flomaru Supplier Discovery System - Stylesheet */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2em;
    margin-bottom: 5px;
}

header p {
    opacity: 0.9;
    font-size: 1.1em;
}

/* Navigation */
nav {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 10px 20px;
    text-decoration: none;
    color: #666;
    border-radius: 5px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: #f0f0f0;
    color: #333;
}

.nav-link.active {
    background: #667eea;
    color: white;
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.card h3 {
    color: #555;
    margin: 20px 0 10px 0;
}

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

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.stat {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-label {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-box {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
}

/* API Status */
.api-status {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.api-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

/* Forms */
.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: #e9ecef;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Country + City Dropdowns */
.country-item {
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-radius: 5px;
    overflow: hidden;
}

.country-item .checkbox-label {
    margin: 0;
    border-radius: 5px 5px 0 0;
}

.city-select-container {
    padding: 0 10px 10px 10px;
}

.city-multiselect {
    width: 100%;
    min-height: 60px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85em;
    background: white;
}

.city-multiselect option {
    padding: 3px 6px;
}

.city-multiselect option:checked {
    background: #667eea;
    color: white;
}

.limits-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 15px 0;
}

.limit-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.limit-input label {
    font-weight: 500;
    color: #555;
}

.limit-input input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.1em;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.form-actions {
    text-align: center;
    margin-top: 30px;
}

/* Tables */
.table-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 15px;
}

.table-scroll {
    overflow-x: auto;
    border: 1px solid #dce4ee;
    border-radius: 10px;
    background: #fff;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.data-table th {
    background: #eef3f8;
    color: #445365;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid #d5e0ec;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #dfe5ec;
    vertical-align: top;
    background: #fff;
}

.data-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.data-table tbody tr:hover td {
    background: #eef4ff;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table a {
    color: #1f5bd2;
    text-underline-offset: 2px;
}

.data-table select,
.data-table input[type="text"],
.data-table input[type="number"],
.data-table input[type="url"],
.data-table input[type="email"] {
    padding: 7px 8px;
    border: 1px solid #d2dce8;
    border-radius: 6px;
    font-size: 0.92em;
    background: #fff;
    color: #334155;
}

.data-table select:focus,
.data-table input[type="text"]:focus,
.data-table input[type="number"]:focus,
.data-table input[type="url"]:focus,
.data-table input[type="email"]:focus {
    outline: 2px solid rgba(102, 126, 234, 0.22);
    outline-offset: 1px;
}

.row-num {
    text-align: center;
    color: #77808b;
    font-size: 0.86em;
    white-space: nowrap;
}

.tier-badge {
    padding: 4px 12px;
    background: #e7f3ff;
    color: #004085;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
}

.score {
    font-weight: bold;
    color: #667eea;
}

.notes-input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Email Viewer */
.email-viewer {
    max-width: 900px;
    margin: 0 auto;
}

.email-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.email-card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.email-header h3 {
    color: #333;
    margin-bottom: 5px;
}

.email-subject {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.email-body {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.email-content {
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.8;
}

.person-profile {
    margin: 20px 0;
    padding: 15px;
    background: #f0f8ff;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.person-profile h4 {
    margin-bottom: 10px;
    color: #667eea;
}

.person-profile p {
    margin: 8px 0;
}

.chat-box {
    margin: 20px 0;
    padding: 15px;
    background: #fff3cd;
    border-radius: 8px;
}

.feedback-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin: 10px 0;
    min-height: 80px;
    font-family: inherit;
}

.email-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.bulk-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Progress */
.progress-bar {
    width: 100%;
    height: 30px;
    background: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
    width: 0%;
}

#progress-log {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.9em;
}

.cost-estimate {
    margin: 20px 0;
    padding: 20px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: #666;
    margin-top: 40px;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .stats {
        grid-template-columns: 1fr;
    }

    .limits-grid {
        grid-template-columns: 1fr;
    }

    .checkbox-group {
        grid-template-columns: 1fr;
    }

    nav {
        flex-direction: column;
    }
}
