
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: #222;
    background: #f7f8fa;

    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: white;
    padding: 20px 8%;
    border-bottom: 1px solid #ddd;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #2563eb;
}

.hero {
    text-align: center;
    padding: 60px 20px;
    background: white;
}

.hero h1 {
    font-size: 36px;
    margin-bottom: 12px;
}

.hero p {
    color: #666;
    font-size: 16px;
}

.search-box {
    margin: 25px auto 0;
    max-width: 550px;
    display: flex;
    gap: 10px;
}

.search-box input {
    flex: 1;
    min-width: 0;
    padding: 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
}

.search-box button {
    padding: 14px 20px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.companies {
    padding: 35px 8%;
}

.companies h2 {
    margin-bottom: 20px;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category {
    background: white;
    border: 1px solid #ddd;
    padding: 10px 16px;
    border-radius: 20px;
}

@media (max-width: 600px) {
    .hero h1 {
        font-size: 28px;
    }

    .search-box {
        flex-direction: column;
    }
}


.company-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 25px;
    align-items: stretch;
}

.company-card {
    background: white;
    padding: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;

    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.company-card h3 {
    margin-top: 0;
}

.company-card p {
    color: #666;
}

.company-card .review-count {
    font-size: 14px;
    color: #888;
}

.company-card button {
    padding: 10px 14px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;

    margin-top: auto;
    align-self: flex-start;
}
.company-card button:hover {
    background: #1d4ed8;
}

@media (max-width: 768px) {
    .company-list {
        grid-template-columns: 1fr;
    }
}


.category {
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.category:hover {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
}

.category.active {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
}


.companies-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.companies-heading h2 {
    margin: 0;
}

.companies-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}


#companySort {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .companies-heading {
        flex-wrap: wrap;
    }

    .companies-actions {
        width: 100%;
        justify-content: flex-end;
    }
}


.add-company-btn {
    padding: 12px 24px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.add-company-btn:hover {
    background-color: #1d4ed8;
}

.back-button {
    padding: 8px 14px;
    background: transparent;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.back-button:hover {
    background: #f3f4f6;
}


/* Browse Categories button */
.browse-categories-wrapper {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0;
    transform: translateY(20px);
}

#browseCategoriesButton {
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #222222;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

#browseCategoriesButton:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}


/* Left-side category directory */

/* Category directory panel */
.category-directory {
    position: fixed;
    top: 0;
    left: 0;
    width: min(420px, 90vw);
    height: 100vh;
    margin: 0;
    padding: 20px 16px;
    box-sizing: border-box;
    overflow-y: auto;
    background: #ffffff;
    border: none;
    border-radius: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
    z-index: 1001;
}

.category-directory[hidden] {
    display: none;
}

.category-directory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.category-directory-header h2 {
    margin: 0;
    font-size: 22px;
    color: #222222;
}

#closeCategoriesButton {
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    background: #ffffff;
    color: #555555;
    font-size: 22px;
    cursor: pointer;
}

#closeCategoriesButton:hover {
    background: #f3f4f6;
}

/* Main category list */
.category-directory-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.main-category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.main-category-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 14px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #f5f5f5;
    color: #292929;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.main-category-item:hover {
    background: #eeeeee;
}

.main-category-item.active {
    background: #f0f0f0;
    border-color: #e5e5e5;
    color: #292929;
}

/* Subcategory list */
.sub-category-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0 8px 12px;
}

.sub-category-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #444444;
    text-align: left;
    font-size: 14px;
    cursor: default;
}

.sub-category-item:hover {
    background: #f7f7f7;
    color: #222222;
}


/* Homepage category spacing */
.companies > .categories {
    margin-top: 24px;
    gap: 12px;
}

/* Consistent company card layout */
.company-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 20px;
}

.company-card {
    min-width: 0;
    min-height: 320px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.company-card .company-name {
    margin: 0 0 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* Main category */
.company-card .company-main-category {
    margin: 0 0 6px;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
}

/* Subcategories */
.company-card .company-subcategories {
    margin: 0 0 10px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

/* Description */
.company-card .company-description {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    margin: 8px 0 12px;
    white-space: pre-line;
}

/* Location */
.company-card .company-location {
    color: #777;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 16px;
    overflow-wrap: anywhere;
}

/* Bottom row: review count + button */
.company-card .company-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.company-card .company-review-count {
    color: #64748b;
    font-size: 13px;
    margin: 0;
    flex-shrink: 0;
}

.company-card .view-company-button {
    margin: 0;
    align-self: auto;
    flex-shrink: 0;
    padding: 10px 14px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.company-card .view-company-button:hover {
    background: #1d4ed8;
}

/* Responsive layout */
@media (max-width: 900px) {
    .company-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .company-list {
        grid-template-columns: 1fr;
    }

    .company-card {
        min-height: 280px;
    }
}




/* ===== Shared Footer ===== */
footer {
    margin-top: auto;
    width: 100%;
    padding: 20px 8%;
    background: #ffffff;
    border-top: 1px solid #ddd;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

footer p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

footer a {
    color: #2563eb;
    font-size: 14px;
    text-decoration: none;
}

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

@media (max-width: 600px) {
    footer {
        padding: 20px;
    }
}

