@import url('../variables.css');

/* cards.css */
.view-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.item-click-area {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.item-card {
    background: var(--bg-card);
    border: var(--border-px) solid var(--border, #eaeaea);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease, border-color 0.2s ease;
    overflow: hidden;
}

@media (hover: hover) {
    .item-card:hover {
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
        border-color: var(--primary, #007bff);
    }
}

.item-card:active {
    transform: translateY(0) scale(0.97);
    transition: transform 0.1s;
}

.card-file:active {
    background: var(--bg-card);
    transform: scale(1);
}

.item-preview {
    width: 100%;
    height: 120px;
    border-radius: var(--radius-md);
    background: var(--bg-soft, #f4f6f8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted, #888);
    margin-bottom: 16px;
    transition: background 0.2s ease;
}

.item-preview svg {
    width: 60px;
    height: 60px;
}

.card-folder .item-preview {
    background: rgba(0, 123, 255, 0.08);
    color: var(--primary, #007bff);
}

.item-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between !important;
}

.item-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: var(--text-main, #333);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.item-desc {
    font-size: 0.9rem;
    color: var(--text-muted, #666);
    margin-bottom: 12px;
    flex-grow: 1;
}

.item-meta {
    font-size: 0.8rem;
    color: var(--text-muted, #999);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px dashed var(--border, #eaeaea);
}

.card-actions {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 4px;
    z-index: 5;
    opacity: 0;
    transition: var(--transition);
}

.item-card:hover .card-actions {
    opacity: 1;
}

.card-actions button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-muted);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: 0.2s;
}

.card-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.card-actions button svg {
    width: 16px;
    height: 16px;
}

.card-add {
    border: var(--border-px) dashed var(--border);
    cursor: pointer;
    background: transparent;
    justify-content: center;
    align-items: center;
    box-shadow: none;
    min-height: var(--card-size);
}

.card-add:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.card-add .item-preview {
    background: transparent;
    border: none;
    height: auto;
    color: var(--text-muted);
}

.card-add .item-title {
    color: var(--text-muted);
    font-size: 15px;
    margin: 0;
}

.card-add:hover .item-preview,
.card-add:hover .item-title {
    color: var(--primary);
}

.course-card {
    text-decoration: none;
}

.course-card:hover .item-title {
    color: var(--primary);
}

/* List Mode */
.view-container.list-mode {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.view-container.list-mode .item-card {
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    height: auto;
    transform: none;
}

.view-container.list-mode .item-preview {
    height: 48px;
    width: 48px;
    border: none;
    background: transparent;
    padding: 0;
    margin-left: 16px;
    border-radius: var(--radius-sm);
}

.view-container.list-mode .item-preview svg {
    width: 28px;
    height: 28px;
}

.view-container.list-mode .item-info {
    padding: 0;
    flex: 1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.view-container.list-mode .item-title {
    margin: 0;
    font-size: 15px;
    flex: 1;
}

.view-container.list-mode .item-desc {
    margin-bottom: 0;
}

.view-container.list-mode .item-meta {
    margin-top: 0;
    width: 150px;
}

.view-container.list-mode .card-actions {
    position: relative;
    top: 0;
    left: 0;
    opacity: 1;
    box-shadow: none;
    margin-right: 16px;
    width: fit-content !important;
}

.view-container.list-mode .card-actions button {
    box-shadow: none;
    background: transparent;
    border-color: transparent;
}

.view-container.list-mode .card-actions button:hover {
    background: var(--bg-hover);
}

.view-container.list-mode .card-add {
    min-height: unset;
    height: auto;
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 16px;
}

.view-container.list-mode .card-add .item-preview {
    padding: 0;
    width: auto;
}

/* =========================================
   Course Schedule Section
   ========================================= */
.schedule-section {
    margin-bottom: 32px;
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.schedule-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.btn-schedule-manage {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-schedule-manage:hover {
    background: var(--bg-hover);
}

.schedule-table-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: var(--border-px) solid var(--border);
    overflow: hidden;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.schedule-table th {
    padding: 16px;
    color: var(--text-muted);
    font-weight: normal;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
}

.schedule-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.schedule-table tr:last-child td {
    border-bottom: none;
}

.schedule-table tr:hover td {
    background: var(--bg-hover);
}

.schedule-day {
    color: var(--text-main);
    font-weight: bold;
}

.schedule-time-badge {
    background: var(--primary-soft);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    white-space: nowrap;
}

.schedule-location {
    color: var(--text-muted);
}

/* Responsive Table for Mobile */
/* Responsive Table for Mobile (Compact Version) */
@media (max-width: 768px) {
    .schedule-header {
        margin-bottom: 12px;
    }

    .schedule-table thead {
        display: none;
    }

    .schedule-table,
    .schedule-table tbody {
        display: block;
        width: 100%;
    }

    .schedule-table tr {
        display: grid;
        grid-template-columns: auto 1fr;
        padding: 10px 12px;
        gap: 6px 12px;
        border-bottom: 1px solid var(--border);
        align-items: center;
    }

    .schedule-table td {
        display: block;
        padding: 0;
        border: none;
        text-align: right;
    }

    /* روز در سمت راست */
    .schedule-table td:nth-child(1) {
        grid-column: 1 / 2;
        font-size: 0.95rem;
    }

    /* ساعت در سمت چپ روبه‌روی روز */
    .schedule-table td:nth-child(2) {
        grid-column: 2 / 3;
        justify-self: end;
    }

    /* مکان در خط پایین */
    .schedule-table td:nth-child(3) {
        grid-column: 1 / 3;
        font-size: 0.85rem;
        color: var(--text-muted);
        display: flex;
        align-items: center;
        gap: 4px;
    }

    /* افزودن آیکون یا لیبل برای مکان به جای لیبل‌های طولانی قبلی */
    .schedule-table td:nth-child(3)::before {
        content: "📍 مکان:";
        font-size: 0.8rem;
        opacity: 0.7;
    }

    /* مخفی کردن لیبل مکان اگر خالی بود (برای خط تیره) */
    .schedule-table td:nth-child(3):empty::before,
    .schedule-table td:nth-child(3):contains("-")::before {
        display: none;
    }

    .schedule-time-badge {
        font-size: 0.8rem;
        padding: 2px 8px;
    }
}


/* =========================================
   Empty State (EduBox)
   ========================================= */
.empty-state-edubox {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    width: 100%;
    min-height: 400px;
}

.edubox-float-anim {
    animation: floatBox 3s ease-in-out infinite;
    margin-bottom: 24px;
}

@keyframes floatBox {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-12px);
    }

    100% {
        transform: translateY(0px);
    }
}

.empty-state-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-main);
}

.empty-state-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 380px;
    line-height: 1.7;
    margin-bottom: 32px;
}

.empty-state-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.edubox-empty-btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}

.edubox-empty-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.edubox-empty-btn-secondary {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid rgba(37, 99, 235, 0.1);
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.edubox-empty-btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--primary);
    transform: translateY(-2px);
}