/* =============================================================================
   JOBFLOW BD - STYLES
   Mobile-first responsive design for multi-site job portal
============================================================================= */

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =============================================================================
   HEADER STYLES
============================================================================= */

.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-icon {
    font-size: 1.8rem;
}

.view-controls {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.view-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.view-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border-color: rgba(255, 255, 255, 0.9);
}

.btn-icon {
    font-size: 1rem;
}

/* =============================================================================
   MAIN LAYOUT STYLES
============================================================================= */

.app-main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

.view-container {
    display: none;
}

.view-container.active {
    display: block;
}

/* =============================================================================
   TAB VIEW STYLES
============================================================================= */

.tab-navigation {
    margin-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.tab-list {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab-list::-webkit-scrollbar {
    height: 4px;
}

.tab-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 2px;
}

.tab-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.tab-button {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    min-width: max-content;
}

.tab-button:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.tab-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

.tab-icon {
    font-size: 1.1rem;
}

.tab-content {
    background: white;
    border-radius: 0 12px 12px 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-height: 70vh;
}

.tab-panel {
    display: none;
    height: 70vh;
    position: relative;
}

.tab-panel.active {
    display: block;
}

.site-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* =============================================================================
   GRID VIEW STYLES
============================================================================= */

.grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.site-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.site-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.card-icon {
    font-size: 1.3rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.card-iframe-container {
    height: 400px;
    position: relative;
    background: #f8fafc;
}

.card-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* =============================================================================
   LOADING AND ERROR STATES
============================================================================= */

.loading-state,
.error-state {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    text-align: center;
}

.error-state.hidden {
    display: none;
}

.loading-spinner,
.error-content {
    max-width: 300px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.retry-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.retry-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

/* Iframe Loading and Error Overlays */
.iframe-loading,
.iframe-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.iframe-error .error-content {
    text-align: center;
}

.iframe-error .error-content h3 {
    margin-bottom: 0.5rem;
    color: #e53e3e;
}

.iframe-error .error-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.refresh-btn,
.external-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.external-btn {
    background: #48bb78;
}

.refresh-btn:hover {
    background: #5a6fd8;
}

.external-btn:hover {
    background: #38a169;
}

/* =============================================================================
   STATUS BAR
============================================================================= */

.status-bar {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 0.75rem 0;
    margin-top: auto;
}

.status-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.status-text {
    font-size: 0.9rem;
    color: #64748b;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.status-label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

/* =============================================================================
   RESPONSIVE BREAKPOINTS
============================================================================= */

/* Tablet (768px and up) */
@media (min-width: 768px) {
    .header-container {
        flex-wrap: nowrap;
    }
    
    .app-title {
        font-size: 2rem;
    }
    
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tab-list {
        flex-wrap: wrap;
        overflow-x: visible;
    }
    
    .card-iframe-container {
        height: 500px;
    }
    
    .tab-content {
        min-height: 80vh;
    }
    
    .tab-panel {
        height: 80vh;
    }
}

/* Desktop (1200px and up) */
@media (min-width: 1200px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .card-iframe-container {
        height: 600px;
    }
    
    .app-main {
        padding: 2rem;
    }
}

/* Large Desktop (1400px and up) */
@media (min-width: 1400px) {
    .header-container,
    .app-main,
    .status-container {
        max-width: 1400px;
    }
}

/* =============================================================================
   ACCESSIBILITY AND FOCUS STYLES
============================================================================= */

.view-btn:focus,
.tab-button:focus,
.action-btn:focus,
.retry-btn:focus,
.refresh-btn:focus,
.external-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .view-btn,
    .tab-button,
    .action-btn {
        border-width: 2px;
    }
    
    .site-card {
        border: 2px solid #333;
    }
}

/* =============================================================================
   UTILITY CLASSES
============================================================================= */

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}