/* Life's Emergency E-Certificate System v3.2 - CSS */

* {
    box-sizing: border-box;
}

#ecert-course-info-v3,
#ecert-add-students-v3,
#ecert-view-certificates-v3 {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(220, 20, 60, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ecert-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    color: white;
    border-radius: 12px;
    border: 3px solid #dc143c;
}

.ecert-step-header h2 {
    color: white;
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

.ecert-step-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ecert-step {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    background: #666;
    color: white;
    transition: all 0.3s ease;
}

.ecert-step.active {
    background: #dc143c;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(220, 20, 60, 0.5);
}

.ecert-step.completed {
    background: #28a745;
}

.ecert-step-line {
    width: 40px;
    height: 3px;
    background: #666;
    border-radius: 2px;
}

.ecert-certificates-counter {
    text-align: center;
    background: linear-gradient(135deg, #dc143c 0%, #8B0000 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 30px;
    margin-bottom: 30px;
    display: inline-block;
    min-width: 250px;
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.3);
}

.ecert-certificates-counter.exhausted {
    background: linear-gradient(135deg, #666 0%, #333 100%);
}

.ecert-certificates-counter .count,
#ecert-remaining-count {
    font-size: 36px;
    font-weight: 900;
    display: block;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.ecert-certificates-counter .label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.ecert-form-grid,
.ecert-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.ecert-field-group {
    display: flex;
    flex-direction: column;
}

.ecert-field-group.full-width {
    grid-column: 1 / -1;
}

.ecert-field-group label {
    font-weight: 700;
    color: #000;
    margin-bottom: 8px;
    font-size: 15px;
}

.required {
    color: #dc143c;
    font-weight: 900;
}

.ecert-field-group input,
.ecert-field-group select,
.ecert-field-group textarea {
    padding: 14px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.ecert-field-group input:focus,
.ecert-field-group select:focus,
.ecert-field-group textarea:focus {
    outline: none;
    border-color: #dc143c;
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.1);
}

.ecert-field-group textarea {
    min-height: 100px;
    resize: vertical;
}

.ecert-expiry-display {
    margin-top: 10px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

/* FIXED: Course Info Summary Styling */
#ecert-course-info-summary,
.ecert-course-summary {
    background: white;
    color: #000;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 3px solid #dc143c;
}

#ecert-course-info-summary h3,
.ecert-course-summary h3 {
    color: #000;
    margin-bottom: 20px;
    border-bottom: 2px solid #dc143c;
    padding-bottom: 10px;
    font-size: 22px;
}

.ecert-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.ecert-info-item {
    background: #f8f9fa;
    padding: 15px 18px;
    border-radius: 8px;
    border-left: 4px solid #dc143c;
}

.ecert-info-item.full-width {
    grid-column: 1 / -1;
}

.ecert-info-item strong {
    color: #dc143c;
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 5px;
    font-weight: 700;
}

.ecert-student-management {
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 30px;
    overflow: hidden;
    border: 2px solid #dc143c;
}

.ecert-tabs {
    display: flex;
    background: #000;
}

.ecert-tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: #666;
    color: white;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ecert-tab-btn.active {
    background: #dc143c;
}

.ecert-tab-btn:hover:not(.active) {
    background: #555;
}

.ecert-tab-content {
    display: none;
    padding: 25px;
}

.ecert-tab-content.active {
    display: block;
}

.ecert-upload-section {
    text-align: center;
}

.ecert-upload-section h4 {
    color: #000;
    margin-bottom: 10px;
    font-size: 20px;
}

.ecert-upload-section p {
    color: #666;
    margin-bottom: 25px;
    font-size: 14px;
}

.ecert-file-upload {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.ecert-file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.ecert-file-label {
    display: inline-block;
    padding: 12px 25px;
    background: #007cba;
    color: white;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ecert-file-label:hover {
    background: #005a87;
    transform: translateY(-2px);
}

.ecert-file-name {
    display: block;
    margin-top: 10px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.ecert-sample-format {
    background: #f1f1f1;
    padding: 20px;
    border-radius: 8px;
    margin-top: 25px;
    text-align: left;
}

.ecert-sample-format h5 {
    margin-bottom: 10px;
    color: #000;
}

.ecert-sample-format pre {
    background: #000;
    color: #0f0;
    padding: 10px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

#ecert-student-list-container {
    background: #f8f9fa;
    border: 2px solid #dc143c;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

#ecert-student-list-container h4 {
    color: #000;
    margin-bottom: 20px;
    border-bottom: 2px solid #dc143c;
    padding-bottom: 10px;
    font-size: 20px;
}

#ecert-student-count {
    color: #dc143c;
    font-weight: 700;
}

.ecert-no-students {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 30px;
    background: rgba(220, 20, 60, 0.05);
    border-radius: 8px;
    border: 2px dashed #dc143c;
}

.ecert-student-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 18px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #ddd;
    border-left: 4px solid #dc143c;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.ecert-student-item:hover {
    box-shadow: 0 2px 10px rgba(220, 20, 60, 0.1);
    transform: translateY(-1px);
}

.ecert-student-number {
    background: #dc143c;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.ecert-student-name {
    font-weight: 600;
    color: #000;
    flex: 1;
    font-size: 16px;
}

.ecert-student-email {
    color: #666;
    font-size: 14px;
    flex: 1;
}

.ecert-remove-student {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.ecert-remove-student:hover {
    background: #c82333;
    transform: scale(1.05);
}

.ecert-btn {
    display: inline-block;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-family: inherit;
}

.ecert-btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.ecert-btn-primary {
    background: linear-gradient(135deg, #dc143c 0%, #8B0000 100%);
    color: white;
}

.ecert-btn-primary:hover {
    background: linear-gradient(135deg, #c41e3a 0%, #7a0000 100%);
    color: white;
}

.ecert-btn-secondary {
    background: #666;
    color: white;
}

.ecert-btn-secondary:hover {
    background: #555;
    color: white;
}

.ecert-btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.ecert-btn-success:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea080 100%);
    color: white;
}

.ecert-btn-danger {
    background: #dc3545;
    color: white;
}

.ecert-btn-danger:hover {
    background: #c82333;
}

.ecert-btn-small {
    padding: 8px 16px;
    font-size: 14px;
    margin: 3px;
}

.ecert-btn-large {
    padding: 18px 36px;
    font-size: 20px;
    font-weight: 800;
}

.ecert-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ecert-form-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #eee;
}

#ecert-actions-section {
    text-align: center;
    margin: 40px 0;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px solid #28a745;
}

.ecert-filter-section {
    background: #f8f9fa;
    padding: 20px 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 2px solid #ddd;
}

.ecert-filter-section label {
    font-weight: 700;
    margin-right: 15px;
    color: #000;
}

.ecert-filter-section select {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}

.ecert-certificates-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.ecert-certificates-list {
    width: 100%;
    border-collapse: collapse;
}

.ecert-certificates-list th {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    color: white;
    padding: 18px 15px;
    text-align: left;
    font-weight: 700;
    border-bottom: 3px solid #dc143c;
    font-size: 16px;
}

.ecert-certificates-list td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    font-size: 15px;
}

.ecert-certificates-list tr:hover {
    background: #f8f9fa;
}

.ecert-cert-number {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #dc143c;
    font-size: 16px;
}

.ecert-actions {
    white-space: nowrap;
}

.ecert-actions .ecert-btn {
    margin: 2px 3px;
}

.ecert-no-certificates {
    text-align: center;
    padding: 50px;
    color: #666;
    font-style: italic;
    font-size: 18px;
}

.ecert-message {
    padding: 18px 25px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid;
    font-weight: 600;
}

.ecert-message.error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.ecert-message.success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.ecert-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

.ecert-message.warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.ecert-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.ecert-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #dc143c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    #ecert-course-info-v3,
    #ecert-add-students-v3,
    #ecert-view-certificates-v3 {
        margin: 10px;
        padding: 15px;
    }
    
    .ecert-form-grid,
    .ecert-input-grid,
    .ecert-info-grid {
        grid-template-columns: 1fr;
    }
    
    .ecert-step-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .ecert-student-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .ecert-certificates-counter {
        min-width: auto;
        width: 100%;
    }
}