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

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

/* ═══════════════════════════════════════════════════════════════ */
/* HEADER */
/* ═══════════════════════════════════════════════════════════════ */

header {
    background: #2c3e50;
    color: white;
    padding: 2rem;
    text-align: center;
}

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

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

.back-link {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.back-link:hover {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════ */
/* HOME PAGE - CATEGORY CARDS */
/* ═══════════════════════════════════════════════════════════════ */

.home {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem 2rem;
}

.category-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    width: 100%;
}

.category-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    border-top: 4px solid #3498db;
}

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

.category-card.shopping {
    border-top-color: #e74c3c;
}

.category-card.medical {
    border-top-color: #27ae60;
}

.category-card.professional {
    border-top-color: #3498db;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.category-card h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.category-card p {
    color: #7f8c8d;
    font-size: 0.95rem;
}

/* ═══════════════════════════════════════════════════════════════ */
/* TOOLS PAGE */
/* ═══════════════════════════════════════════════════════════════ */

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.tools-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.loading {
    text-align: center;
    color: #7f8c8d;
    padding: 2rem;
}

.error {
    text-align: center;
    color: #e74c3c;
    padding: 2rem;
    background: #fdf2f2;
    border-radius: 8px;
}

.loading-tools,
.no-tools {
    text-align: center;
    color: #7f8c8d;
    padding: 1rem;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════ */
/* SERVER DROPDOWN (OUTER) */
/* ═══════════════════════════════════════════════════════════════ */

.server {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    user-select: none;
    background: #34495e;
    color: white;
    transition: background 0.2s;
}

.server-header:hover {
    background: #3d566e;
}

.server-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.server-title h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.server-title .chevron {
    transition: transform 0.3s;
    font-size: 0.8rem;
}

.server.open .server-title .chevron {
    transform: rotate(90deg);
}

.tool-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.server-content {
    display: none;
    padding: 0;
}

.server.open .server-content {
    display: block;
}

.tools-list {
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════ */
/* TOOL DROPDOWN (INNER) */
/* ═══════════════════════════════════════════════════════════════ */

.tool {
    border-bottom: 1px solid #eee;
}

.tool:last-child {
    border-bottom: none;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    padding-left: 2.5rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.tool-header:hover {
    background: #f8f9fa;
}

.tool-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.tool-title h4 {
    color: #2c3e50;
    font-size: 0.95rem;
    font-weight: 500;
}

.tool-title .chevron {
    color: #7f8c8d;
    transition: transform 0.3s;
    font-size: 0.7rem;
}

.tool.open .tool-title .chevron {
    transform: rotate(90deg);
}

.copy-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s, transform 0.1s;
}

.copy-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn.copied {
    background: #27ae60;
}

/* Tool Content (JSON display) */
.tool-content {
    display: none;
}

.tool.open .tool-content {
    display: block;
}

.json-display {
    padding: 1.5rem;
    padding-left: 2.5rem;
    overflow-x: auto;
    background: #1e1e1e;
    margin: 0;
}

.json-display code {
    color: #9cdcfe;
    font-family: 'Fira Code', 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    white-space: pre;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════ */
/* RESPONSIVE */
/* ═══════════════════════════════════════════════════════════════ */

@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }

    .home {
        padding: 2rem 1rem;
    }

    .category-card {
        padding: 2rem 1.5rem;
    }

    main {
        padding: 1rem;
    }

    .server-header {
        padding: 0.8rem 1rem;
    }

    .tool-header {
        padding: 0.6rem 1rem;
        padding-left: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .copy-btn {
        align-self: flex-end;
    }

    .json-display {
        padding: 1rem;
    }

    .json-display code {
        font-size: 0.7rem;
    }
}

/* ═══════════════════════════════════════════════════════════════ */
/* MOCK DATA BUTTON */
/* ═══════════════════════════════════════════════════════════════ */

.mock-data-btn {
    background: #9b59b6;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.3s;
    margin-left: auto;
}

.mock-data-btn:hover {
    background: #8e44ad;
}

.mock-data-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════ */
/* MOCK DATA MODAL */
/* ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 95vw;
    max-height: 90vh;
    width: 1200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #2c3e50;
    color: white;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 500;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.modal-close:hover {
    opacity: 1;
}

.sheet-tabs {
    display: flex;
    gap: 0;
    background: #ecf0f1;
    border-bottom: 2px solid #bdc3c7;
    overflow-x: auto;
}

.sheet-tab {
    padding: 0.8rem 1.5rem;
    background: #ecf0f1;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #7f8c8d;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}

.sheet-tab:hover {
    background: #d5dbdb;
}

.sheet-tab.active {
    background: white;
    color: #2c3e50;
    border-bottom-color: #3498db;
}

.modal-body {
    overflow: auto;
    flex: 1;
    padding: 1rem;
}

.sheet-content {
    display: none;
}

.sheet-content.active {
    display: block;
}

/* Style the generated table from SheetJS */
.sheet-content table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.85rem;
}

.sheet-content th,
.sheet-content td {
    border: 1px solid #ddd;
    padding: 0.5rem 0.8rem;
    text-align: left;
}

.sheet-content th {
    background: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.sheet-content tr:nth-child(even) {
    background: #f8f9fa;
}

.sheet-content tr:hover {
    background: #e8f4fc;
}

/* Mobile adjustments for modal */
@media (max-width: 768px) {
    .modal-content {
        width: 100%;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .sheet-tab {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
    
    .sheet-content table {
        font-size: 0.75rem;
    }
    
    .sheet-content th,
    .sheet-content td {
        padding: 0.3rem 0.5rem;
    }
}
