/* ============================================
   SESEC Partner Map - Styles
   ============================================ */

/* CSS Variables - SESEC Branding */
:root {
    --primary: #0f2942;
    --primary-dark: #0a1a2b;
    --primary-light: #1e3a5f;
    --secondary: #ea6a47;
    --accent: #17a2b8;
    --gold: #f4b942;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8f9fa;
    --card: #ffffff;
    --text: #0f2942;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    color: white;
    padding: 40px 20px;
    box-shadow: var(--shadow-lg);
    position: relative;
    min-height: 310px;
}

.header-logo {
    position: absolute;
    top: 20px;
    left: 20px;
    height: 270px;
    width: auto;
    opacity: 1;
    z-index: 1;
}

.header-content {
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

.header-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 10px;
}

.header-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.25rem);
    opacity: 0.95;
    max-width: 800px;
    line-height: 1.6;
    font-weight: 500;
    text-align: right;
    margin-left: auto;
}

.stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

.stat {
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 25px;
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    flex: 1 1 150px;
    min-width: 140px;
}

.stat-number {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px 0;
}

/* Controls Section */
.controls {
    background: var(--card);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 15px 20px 15px 50px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 41, 66, 0.1);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

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

.filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
    min-height: 40px;
    display: flex;
    align-items: center;
    line-height: 1.3;
}

.filter-group select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: var(--transition);
    height: 44px;
    width: 100%;
}

.filter-group select[multiple] {
    height: auto;
    min-height: 44px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}

.filter-group select[multiple] option {
    padding: 6px 8px;
    border-radius: 4px;
    margin: 2px 0;
    cursor: pointer;
}

.filter-group select[multiple] option:checked {
    background: var(--secondary);
    color: white;
}

.filter-group select[multiple] option[data-category-header] {
    font-weight: 700;
    background: #f8f9fa !important;
    color: var(--primary);
    padding: 8px 8px;
    margin-top: 8px;
    cursor: pointer;
    border-bottom: 2px solid var(--border);
}

.filter-group select[multiple] option[data-category-header]:checked {
    background: var(--primary) !important;
    color: white;
}

.filter-group select[multiple] optgroup {
    font-weight: 600;
    color: var(--primary);
    margin-top: 8px;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 41, 66, 0.1);
}

.filter-group select:hover {
    border-color: var(--secondary);
}

/* Active Filters */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--secondary);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

.filter-tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    margin-left: 4px;
    transition: var(--transition);
}

.filter-tag button:hover {
    transform: scale(1.2);
}

.clear-filters {
    padding: 8px 16px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.clear-filters:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Results Info */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 15px;
}

.results-count {
    font-weight: 600;
    color: var(--text);
}

.view-toggle {
    display: flex;
    gap: 10px;
}

.view-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
}

.view-btn:hover {
    border-color: var(--secondary);
    background: rgba(234, 106, 71, 0.05);
}

.view-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Partner Cards - Grid View */
.partners-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.partners-grid.active {
    display: grid;
}

.partner-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
    animation: fadeIn 0.5s ease;
}

.partner-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.partner-name {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--primary);
    line-height: 1.3;
}

.partner-mission {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.category-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--secondary);
    color: white;
    white-space: nowrap;
}

.category-badge.cat1 { background: var(--primary); }
.category-badge.cat2 { background: var(--secondary); }
.category-badge.cat3 { background: var(--accent); }
.category-badge.cat4 { background: var(--gold); color: var(--primary); }

.partner-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.meta-item {
    display: flex;
    align-items: start;
    gap: 8px;
}

.meta-icon {
    color: var(--primary);
    font-weight: bold;
    flex-shrink: 0;
}

/* List View */
.partners-list {
    display: none;
}

.partners-list.active {
    display: block;
}

/* Map View */
.partners-map {
    display: none !important;
}

.partners-map.active {
    display: block !important;
}

#mapContainer {
    height: 600px;
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 40px;
}

.leaflet-popup-content {
    font-family: inherit;
}

.leaflet-popup-content h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin: 0 0 10px 0;
}

.leaflet-popup-content p {
    margin: 5px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.leaflet-popup-content strong {
    color: var(--text);
    font-weight: 600;
}

.leaflet-popup-content a {
    color: var(--secondary);
    text-decoration: none;
    transition: var(--transition);
}

.leaflet-popup-content a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.partner-list-item {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border-left: 4px solid transparent;
    animation: fadeIn 0.5s ease;
}

.partner-list-item:hover {
    border-left-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateX(4px);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card);
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    position: relative;
    margin: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 30px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 10;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 5px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
    transform: scale(1.1);
}

.modal-body {
    padding: 30px;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detail-item {
    padding: 15px;
    background: var(--bg);
    border-radius: var(--radius);
}

.detail-label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.detail-value {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
}

.contact-item a {
    color: var(--primary);
    text-decoration: none;
    word-break: break-all;
    transition: var(--transition);
}

.contact-item a:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.themes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.theme-tag {
    padding: 6px 12px;
    background: var(--bg);
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.85rem;
    color: var(--text);
    border: 1px solid var(--border);
}

/* Footer */
.footer {
    background: var(--text);
    color: white;
    padding: 40px 20px 20px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.footer-section p {
    opacity: 0.9;
    line-height: 1.6;
    margin-bottom: 10px;
}

.footer-section a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: white;
    text-decoration: underline;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-meta {
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 20px;
    text-align: center;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 30px 20px;
        min-height: 260px;
    }

    .header-logo {
        height: 225px;
        top: 15px;
        left: 15px;
    }

    .header-title {
        font-size: 1.8rem;
    }

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

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

    .stats {
        gap: 15px;
    }

    .stat {
        flex: 1 1 140px;
    }

    .results-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-content {
        max-height: 95vh;
    }

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

    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    #mapContainer {
        height: 400px;
    }

    .view-toggle {
        flex-direction: column;
        gap: 5px;
    }

    .view-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header {
        min-height: 212px;
    }

    .header-logo {
        height: 180px;
        top: 12px;
        left: 12px;
    }

    .controls {
        padding: 20px 15px;
    }

    .partner-card {
        padding: 20px;
    }

    .modal-header,
    .modal-body {
        padding: 20px;
    }
}

/* Print Styles */
@media print {
    .header,
    .controls,
    .results-info,
    .footer,
    .view-toggle {
        display: none;
    }

    .partners-grid,
    .partners-list {
        display: block !important;
    }

    .partner-card,
    .partner-list-item {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border);
    }
}
