/**
 * Course Directory Plugin Styles
 * Modern, responsive design for course directory tables
 */

/* Container */
.course-directory-wrapper {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Header */
.course-directory-header {
    margin-bottom: 2rem;
}

.course-directory-title {
    font-size: 2rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding-bottom: 1rem;
    border-bottom: 3px solid #b11218;
}

/* Tabs Navigation */
.cd-tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0 0 2rem 0;
    padding: 0;
    border-bottom: 2px solid #e5e5e5;
}

.cd-tab-item {
    margin: 0;
    padding: 0;
}

.cd-tab-link {
    display: block;
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    bottom: -2px;
}

.cd-tab-link:hover {
    color: #b11218;
    background: #f9f9f9;
}

.cd-tab-link.active {
    color: #b11218;
    border-bottom-color: #b11218;
    font-weight: 600;
}

/* Tab Content */
.cd-tab-content {
    position: relative;
}

.cd-tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.cd-tab-pane.active {
    display: block;
}

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

/* DataTables Customization */
.course-directory-table {
    border-collapse: collapse !important;
    width: 100% !important;
}

.course-directory-table thead th {
    background-color: #555 !important;
    color: white !important;
    padding: 0.75rem !important;
    text-align: left !important;
    font-weight: 600 !important;
    border-bottom: 2px solid #ddd !important;
}

.course-directory-table tbody tr {
    transition: background-color 0.2s ease;
}

.course-directory-table tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

.course-directory-table tbody tr:hover {
    background-color: #f0f0f0;
}

.course-directory-table tbody td {
    padding: 0.75rem !important;
    border-top: 1px solid #ddd !important;
    vertical-align: middle !important;
}

/* Text Alignment */
.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

/* Course File Links */
.course-file-link {
    color: #b11218;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.course-file-link:hover {
    color: #8b0e13;
    text-decoration: underline;
}

/* DataTables Search and Info */
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter input {
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    margin-left: 0.5rem;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #b11218;
}

.dataTables_wrapper .dataTables_length select {
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    margin: 0 0.5rem;
    font-size: 0.95rem;
}

.dataTables_wrapper .dataTables_info {
    padding-top: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 1rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.4rem 0.8rem;
    margin: 0 0.2rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #333 !important;
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f0f0f0 !important;
    border-color: #b11218 !important;
    color: #b11218 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #b11218 !important;
    border-color: #b11218 !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .course-directory-title {
        font-size: 1.5rem;
    }

    .cd-tab-nav {
        flex-direction: column;
        border-bottom: none;
    }

    .cd-tab-link {
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
        bottom: 0;
    }

    .cd-tab-link.active {
        border-left-color: #b11218;
        border-bottom-color: transparent;
        background: #f9f9f9;
    }

    /* Make table scrollable on mobile */
    .dataTables_wrapper {
        overflow-x: auto;
    }

    .course-directory-table {
        min-width: 600px;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left;
        margin-bottom: 1rem;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: center;
    }
}

@media screen and (max-width: 480px) {
    .cd-tab-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .course-directory-table thead th,
    .course-directory-table tbody td {
        padding: 0.5rem !important;
        font-size: 0.85rem;
    }
}

/* Loading State */
.dataTables_wrapper .dataTables_processing {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* POI Modal */
.poi-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    min-width: 100%;
}

.poi-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 1000px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.poi-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #e5e5e5;
    background: #f9f9f9;
    border-radius: 8px 8px 0 0;
}

.poi-modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
}

.poi-modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.poi-modal-close:hover {
    background: #e5e5e5;
    color: #b11218;
}

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

/* Loading Spinner */
.poi-loading {
    text-align: center;
    padding: 3rem 1rem;
}

.poi-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #b11218;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.poi-loading p {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

/* Error Message */
.poi-error {
    background: #fff5f5;
    border: 1px solid #fc8181;
    border-radius: 4px;
    padding: 1rem;
    color: #c53030;
    text-align: center;
}

.poi-error p {
    margin: 0;
}

/* Files List */
.poi-files-list {
    display: none;
}

.poi-files-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.poi-files-table thead {
    background: #555;
    color: white;
}

.poi-files-table thead th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid #ddd;
}

.poi-files-table tbody tr {
    border-bottom: 1px solid #e5e5e5;
    transition: background-color 0.2s ease;
}

.poi-files-table tbody tr:hover {
    background-color: #f9f9f9;
}

.poi-files-table tbody td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
}

.poi-file-name-col {
    max-width: 300px;
}

.poi-file-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #b11218;
    font-weight: 500;
    transition: color 0.2s ease;
}

.poi-file-link:hover {
    color: #8b0e13;
    text-decoration: underline;
}

.poi-file-icon {
    font-size: 1.3rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.poi-file-link span {
    word-break: break-word;
}

.poi-file-type {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
    text-align: center;
    width: 80px;
}

.poi-file-size {
    font-size: 0.9rem;
    color: #666;
    text-align: right;
    width: 100px;
}

.poi-file-date {
    font-size: 0.9rem;
    color: #666;
    text-align: right;
    width: 120px;
}

/* POI Description */
.pois-description {
    color: #666;
    font-size: 1rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Responsive Modal */
@media screen and (max-width: 768px) {
    .poi-modal-content {
        max-height: 90vh;
    }

    .poi-modal-header h3 {
        font-size: 1.2rem;
    }

    .poi-files-table {
        font-size: 0.9rem;
    }

    .poi-files-table thead th {
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
    }

    .poi-files-table tbody td {
        padding: 0.7rem 0.5rem;
    }

    .poi-file-icon {
        font-size: 1.2rem;
        margin-right: 0.5rem;
    }

    .poi-file-type,
    .poi-file-size,
    .poi-file-date {
        font-size: 0.85rem;
    }
}

@media screen and (max-width: 480px) {
    .poi-modal {
        padding: 0.5rem;
    }

    .poi-modal-header {
        padding: 1rem;
    }

    .poi-modal-header h3 {
        font-size: 1rem;
        line-height: 1.3;
    }

    .poi-modal-body {
        padding: 0.75rem;
        overflow-x: auto;
    }

    .poi-files-table {
        font-size: 0.85rem;
        min-width: 500px;
    }

    .poi-files-table thead th {
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }

    .poi-files-table tbody td {
        padding: 0.6rem 0.4rem;
    }

    .poi-file-icon {
        font-size: 1.1rem;
        margin-right: 0.4rem;
    }

    .poi-file-type,
    .poi-file-size,
    .poi-file-date {
        font-size: 0.8rem;
    }
}

/* ============================
   Add / Update Upload Form
   ============================ */

.cd-upload-wrapper {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    position: relative;
}

.cd-upload-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 2rem 0;
    padding-bottom: 1rem;
    border-bottom: 3px solid #b11218;
}

.cd-upload-notice {
    background: #fff5f5;
    border: 1px solid #fc8181;
    border-radius: 6px;
    padding: 1rem 1.5rem;
    color: #c53030;
    text-align: center;
    max-width: 600px;
    margin: 2rem auto;
}

/* Steps */
.cd-step-heading {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 1.25rem 0;
}

.cd-step-subtext {
    color: #555;
    font-size: 0.95rem;
    margin: 0 0 1.5rem 0;
    line-height: 1.6;
}

.cd-step-subtext code {
    background: #f4f4f5;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

/* Type Selection Cards */
.cd-type-cards {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.cd-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    padding: 2rem 1.5rem;
    cursor: pointer;
    transition: all 0.25s ease;
    width: 260px;
    text-align: center;
    font-family: inherit;
    font-size: inherit;
}

.cd-type-card:hover {
    border-color: #b11218;
    box-shadow: 0 4px 12px rgba(177, 18, 24, 0.12);
    transform: translateY(-2px);
}

.cd-type-card.selected {
    border-color: #b11218;
    background: #fef2f2;
}

.cd-type-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.cd-type-label {
    font-size: 1.15rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.cd-type-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

/* Form Fields */
.cd-form-group {
    margin-bottom: 1.5rem;
}

.cd-form-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.cd-form-select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #333;
    appearance: auto;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.cd-form-select:focus {
    outline: none;
    border-color: #b11218;
}

.cd-form-input {
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #333;
    transition: border-color 0.2s ease;
}

.cd-form-input:focus {
    outline: none;
    border-color: #b11218;
}

/* Drop Zone */
.cd-dropzone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    transition: all 0.25s ease;
    background: #fafafa;
    margin-bottom: 1.5rem;
}

.cd-dropzone.dragover {
    border-color: #b11218;
    background: #fef2f2;
}

.cd-dropzone-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.75rem;
}

.cd-dropzone-text {
    font-size: 1.05rem;
    color: #555;
    margin: 0 0 0.5rem 0;
}

.cd-dropzone-or {
    color: #999;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.cd-browse-btn {
    display: inline-block;
    background: #b11218;
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.cd-browse-btn:hover {
    background: #8b0e13;
}

/* Selected file display */
.cd-dropzone-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.cd-file-icon {
    font-size: 2rem;
}

.cd-file-name {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
}

.cd-file-remove {
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: inherit;
}

.cd-file-remove:hover {
    background: #fee;
    border-color: #b11218;
    color: #b11218;
}

/* Action Buttons */
.cd-upload-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.cd-btn {
    padding: 0.7rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
}

.cd-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cd-btn-primary {
    background: #b11218;
    color: white;
}

.cd-btn-primary:hover:not(:disabled) {
    background: #8b0e13;
}

.cd-btn-secondary {
    background: white;
    color: #333;
    border: 2px solid #ddd;
}

.cd-btn-secondary:hover {
    border-color: #999;
    background: #f9f9f9;
}

/* Loading Overlay */
.cd-upload-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 10;
}

.cd-upload-loading p {
    margin: 1rem 0 0;
    color: #555;
    font-size: 1rem;
}

/* Results */
.cd-result-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    color: #166534;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.cd-result-error {
    background: #fff5f5;
    border: 1px solid #fc8181;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    color: #c53030;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.cd-result-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Preview Table */
.cd-preview-table-wrap {
    margin-bottom: 1.5rem;
}

.cd-preview-table-wrap h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.75rem 0;
}

.cd-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.cd-preview-table thead th {
    background: #555;
    color: white;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
}

.cd-preview-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e5e5;
    color: #333;
}

.cd-preview-table tbody tr:nth-child(odd) {
    background: #f9f9f9;
}

/* Responsive */
@media screen and (max-width: 600px) {
    .cd-type-cards {
        flex-direction: column;
        align-items: center;
    }

    .cd-type-card {
        width: 100%;
        max-width: 300px;
    }

    .cd-upload-actions {
        flex-direction: column;
    }

    .cd-btn {
        width: 100%;
        text-align: center;
    }

    .cd-preview-table {
        font-size: 0.8rem;
    }
}
