/* Smart Test Manager - Enhanced Responsive Layout */

/* CSS Reset and Base Styles */
* {
    box-sizing: border-box;
}

/* Container and Grid System */
.stm-tests {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Responsive Grid Breakpoints */
@media (min-width: 576px) {
    .stm-tests {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1.5rem;
    }
}

@media (min-width: 768px) {
    .stm-tests {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 992px) {
    .stm-tests {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
        padding: 2rem;
    }
}

@media (min-width: 1200px) {
    .stm-tests {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
}

/* Enhanced Test Card Layout */
.stm-test {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    min-height: 300px;
}

.stm-test:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: #d1d5db;
}

/* Typography and Content Hierarchy */
.stm-test h3 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 1rem 0;
    color: #1f2937;
    word-wrap: break-word;
}

@media (min-width: 768px) {
    .stm-test h3 {
        font-size: 1.375rem;
    }
}

/* Description Content */
.stm-desc {
    flex-grow: 1;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    color: #4b5563;
}

.stm-desc p {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
}

.stm-desc img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

/* Enhanced Meta Section */
.stm-meta {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

@media (min-width: 480px) {
    .stm-meta {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* Price Styling */
.stm-price {
    font-weight: 700;
    font-size: 1.125rem;
    color: #059669;
    order: 2;
}

@media (min-width: 480px) {
    .stm-price {
        order: 1;
        font-size: 1.25rem;
    }
}

/* Enhanced Button Styling */
.stm-meta .button,
.stm-meta a.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 120px;
    padding: 0.75rem 1.5rem;
    background-color: #059669;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    order: 1;
}

@media (min-width: 480px) {
    .stm-meta .button,
    .stm-meta a.button {
        order: 2;
        font-size: 0.9rem;
    }
}

.stm-meta .button:hover,
.stm-meta a.button:hover {
    background-color: #047857;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.stm-meta .button:active,
.stm-meta a.button:active {
    transform: translateY(0);
}

/* Focus States for Accessibility */
.stm-meta .button:focus,
.stm-meta a.button:focus {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

/* Student Tests Section */
.stm-student-tests {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

.stm-student-tests h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1f2937;
    text-align: center;
}

.stm-student-tests ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stm-student-tests li {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.stm-student-tests a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.5rem 1rem;
    background-color: #3b82f6;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.stm-student-tests a:hover {
    background-color: #2563eb;
}

.stm-student-tests a:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Empty State Styling */
.stm-tests p,
.stm-student-tests p {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 2rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
}

/* Responsive Typography */
@media (max-width: 575px) {
    .stm-test {
        padding: 1.25rem;
        min-height: auto;
    }
    
    .stm-test h3 {
        font-size: 1.125rem;
    }
    
    .stm-desc p {
        font-size: 0.8125rem;
    }
    
    .stm-price {
        font-size: 1rem;
    }
}

/* High DPI Display Optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .stm-test {
        border-width: 0.5px;
    }
}

/* Print Styles */
@media print {
    .stm-tests {
        display: block;
    }
    
    .stm-test {
        break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .stm-meta .button,
    .stm-meta a.button {
        display: none;
    }
}
