/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 2rem 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin: 0 -20px 2rem -20px;
    border-radius: 0 0 15px 15px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main content */
main {
    flex: 1;
}

/* Filters */
.filters {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: #555;
}

#marketFilter,
#contactedFilter {
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

#marketFilter:focus,
#contactedFilter:focus {
    outline: none;
    border-color: #667eea;
}

/* Loading and error states */
.loading, .error {
    text-align: center;
    padding: 2rem;
    font-size: 1.1rem;
}

.loading {
    color: #667eea;
}

.error {
    color: #e74c3c;
    background: #ffeaea;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
}

/* Results */
.results {
    margin-bottom: 2rem;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Card styles */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e1e5e9;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-header {
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.contact-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
    user-select: none;
}

.contact-checkbox {
    margin-right: 0.5rem;
    cursor: pointer;
    transform: scale(1.1);
}

.contact-checkbox:checked + .checkbox-text {
    color: #4CAF50;
    font-weight: 600;
}

.card-title a {
    color: inherit;
    text-decoration: none;
    transition: text-decoration 0.2s ease;
}

.card-title a:hover {
    text-decoration: underline;
}

.card-market {
    color: #667eea;
    font-weight: 600;
    background: #f0f4ff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    display: inline-block;
    font-size: 0.9rem;
}

.card-body {
    margin-bottom: 1rem;
}

.card-url {
    margin-bottom: 1rem;
}

.card-url a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
}

.card-url a:hover {
    text-decoration: underline;
}

.card-contacts {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #555;
    overflow: hidden;
    min-width: 0;
}

.contact-item a {
    color: #667eea;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.contact-item a:hover {
    text-decoration: underline;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e1e5e9;
    font-size: 0.85rem;
    color: #888;
}

.card-footer a {
    color: inherit;
    text-decoration: none;
    transition: text-decoration 0.2s ease;
}

.card-footer a:hover {
    text-decoration: underline;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #555;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: #666;
    border-top: 1px solid #e1e5e9;
    margin-top: 2rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    header {
        margin: 0 -15px 1.5rem -15px;
        padding: 1.5rem 0;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .filters {
        padding: 1rem;
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .cards-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card {
        padding: 1rem;
    }

    .card-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    header {
        margin: 0 -10px 1rem -10px;
        padding: 1rem 0;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .card-contacts {
        font-size: 0.85rem;
    }

    .contact-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        overflow: hidden;
        width: 100%;
    }

    .contact-item a {
        width: 100%;
        max-width: 100%;
    }
}

/* Contact Status Section */
.contact-status-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e1e5e9;
}

/* Contact Template Button */
.contact-template-section {
    margin-top: 1rem;
}

.contact-template-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
    width: 100%;
}

.contact-template-btn:hover {
    background: #218838;
}

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

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 0 1.5rem;
    border-bottom: 1px solid #e1e5e9;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin: 0 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid #e1e5e9;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-copy-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

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

.modal-close-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

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