/**
 * Excel Shortcuts Hub Frontend Styles
 * Responsive design with accessibility support
 */

.excel-shortcuts-hub {
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Controls Section */
.excel-shortcuts-controls-section {
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.excel-shortcuts-controls-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

.excel-shortcuts-search-group {
    flex: 2;
    min-width: 250px;
}

.excel-shortcuts-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.excel-shortcuts-search-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.excel-shortcuts-category-group {
    flex: 1;
    min-width: 150px;
}

.excel-shortcuts-category-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.excel-shortcuts-category-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.excel-shortcuts-downloads-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.excel-shortcuts-search-results-count {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    text-align: center;
}

.excel-shortcuts-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.excel-shortcuts-download-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
}

.excel-shortcuts-download-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.3);
}

.excel-shortcuts-download-pdf {
    background: #dc3545;
}

.excel-shortcuts-download-pdf:hover {
    background: #c82333;
}

.excel-shortcuts-download-sheets {
    background: #28a745;
}

.excel-shortcuts-download-sheets:hover {
    background: #218838;
}

/* Loading and Error States */
.excel-shortcuts-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.excel-shortcuts-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: excel-shortcuts-spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes excel-shortcuts-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.excel-shortcuts-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin-bottom: 20px;
}

.excel-shortcuts-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* Table Styles */
.excel-shortcuts-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.excel-shortcuts-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

.excel-shortcuts-table th {
    background: #f8f9fa;
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.excel-shortcuts-table th:hover {
    background: #e9ecef;
}

.excel-shortcuts-table th:focus {
    outline: none;
    background: #e9ecef;
    box-shadow: inset 0 0 0 2px #007cba;
}

.excel-shortcuts-table th.sort-asc,
.excel-shortcuts-table th.sort-desc {
    background: #e9ecef;
}

.excel-shortcuts-sort-indicator {
    margin-left: 5px;
    color: #007cba;
    font-weight: bold;
}

.excel-shortcuts-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

.excel-shortcuts-table tbody tr:hover {
    background: #f8f9fa;
}

.excel-shortcuts-table tbody tr:nth-child(even) {
    background: #fdfdfd;
}

.excel-shortcuts-table tbody tr:nth-child(even):hover {
    background: #f8f9fa;
}

/* Keyboard shortcuts styling */
.excel-shortcuts-kbd {
    display: inline-block;
    padding: 4px 8px;
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    color: #3c4043;
    white-space: nowrap;
}

/* Column specific styles */
.excel-shortcuts-col-action {
    width: 40%;
    min-width: 200px;
}

.excel-shortcuts-col-windows,
.excel-shortcuts-col-mac {
    width: 20%;
    min-width: 120px;
}

.excel-shortcuts-col-category {
    width: 20%;
    min-width: 100px;
}

.excel-shortcuts-cell-category {
    font-weight: 500;
    color: #666;
}

/* Video Section */
.excel-shortcuts-videos {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.excel-shortcuts-videos h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.excel-shortcuts-video-placeholder {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 6px;
    border: 2px dashed #ddd;
    color: #666;
}

/* Banner */
.excel-shortcuts-banner {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    border-radius: 8px;
}

.excel-shortcuts-banner a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

.excel-shortcuts-banner a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .excel-shortcuts-controls-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .excel-shortcuts-search-group,
    .excel-shortcuts-category-group {
        flex: none;
        min-width: auto;
    }
    
    .excel-shortcuts-downloads-group {
        justify-content: center;
        margin-top: 10px;
    }
    
    .excel-shortcuts-table {
        font-size: 13px;
    }
    
    .excel-shortcuts-table th,
    .excel-shortcuts-table td {
        padding: 8px 6px;
    }
    
    .excel-shortcuts-col-action {
        width: 50%;
        min-width: 150px;
    }
    
    .excel-shortcuts-col-windows,
    .excel-shortcuts-col-mac {
        width: 25%;
        min-width: 80px;
    }
    
    .excel-shortcuts-col-category {
        display: none; /* Hide category column on mobile */
    }
}

@media (max-width: 640px) {
    .excel-shortcuts-hub {
        margin: 0 -10px;
    }
    
    .excel-shortcuts-controls-section {
        margin: 0 10px 20px;
        padding: 15px;
    }
    
    .excel-shortcuts-table-container {
        margin: 0 10px 20px;
    }
    
    .excel-shortcuts-table {
        font-size: 12px;
    }
    
    .excel-shortcuts-kbd {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    /* Stack table layout for very small screens */
    .excel-shortcuts-table,
    .excel-shortcuts-table thead,
    .excel-shortcuts-table tbody,
    .excel-shortcuts-table th,
    .excel-shortcuts-table td,
    .excel-shortcuts-table tr {
        display: block;
    }
    
    .excel-shortcuts-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .excel-shortcuts-table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 6px;
        background: white;
    }
    
    .excel-shortcuts-table td {
        border: none;
        position: relative;
        padding: 8px 8px 8px 120px;
        text-align: left;
    }
    
    .excel-shortcuts-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 8px;
        width: 100px;
        font-weight: 600;
        color: #666;
    }
    
    .excel-shortcuts-cell-action:before {
        content: "Action: ";
    }
    
    .excel-shortcuts-cell-windows:before {
        content: "Windows: ";
    }
    
    .excel-shortcuts-cell-mac:before {
        content: "macOS: ";
    }
    
    .excel-shortcuts-cell-category:before {
        content: "Category: ";
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .excel-shortcuts-table th {
        border: 2px solid #000;
    }
    
    .excel-shortcuts-table td {
        border: 1px solid #000;
    }
    
    .excel-shortcuts-kbd {
        border: 2px solid #000;
        background: #fff;
        color: #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .excel-shortcuts-download-btn,
    .excel-shortcuts-search-input,
    .excel-shortcuts-category-select {
        transition: none;
    }
    
    .excel-shortcuts-spinner {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .excel-shortcuts-search-section,
    .excel-shortcuts-downloads,
    .excel-shortcuts-videos,
    .excel-shortcuts-banner {
        display: none;
    }
    
    .excel-shortcuts-table {
        border-collapse: collapse;
        width: 100%;
    }
    
    .excel-shortcuts-table th,
    .excel-shortcuts-table td {
        border: 1px solid #000;
        padding: 8px;
    }
}