/* Certificate Frontend Styles */

/* Certificate Selector */
.tbvs-certificate-selector {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

/* Certificate Grid */
.certificate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.certificate-card {
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    transition: all 0.3s ease;
    position: relative;
}

.certificate-card:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 15px rgba(0,115,170,0.2);
    transform: translateY(-2px);
}

.certificate-card.selected {
    border-color: #00a32a;
    background: #f0f6fc;
    box-shadow: 0 4px 15px rgba(0,163,42,0.3);
}

.certificate-item input[type="radio"] {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.certificate-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 15px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
}

.certificate-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.certificate-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #23282d;
}

.certificate-price {
    display: inline-block;

    color: white;
    padding: 8px 0;
    border-radius: 20px;
    font-weight: bold;
    font-size: 18px;
    margin-right: 10px;
}

.certificate-validity {
    display: inline-block;
    color: #666;
    font-size: 14px;
}

.certificate-description {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 15px;
}

.certificate-details {
    margin-bottom: 15px;
}

.certificate-select-btn {
    background: #00a32a;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
}

.certificate-select-btn:hover {
    background: #008a20;
}

.certificate-select-btn:active {
    transform: translateY(1px);
}

/* Purchase Form */
.certificate-purchase-form {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.certificate-purchase-form h3 {
    margin: 0 0 20px 0;
    color: #23282d;
    font-size: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #23282d;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.1);
}

.form-group.required label::after {
    content: " *";
    color: #d63638;
}

.form-group .field-description {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

/* Selected Certificate Summary */
.selected-certificate-summary {
    background: #fff;
    border: 2px solid #00a32a;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.selected-certificate-summary h4 {
    margin: 0 0 15px 0;
    color: #23282d;
    font-size: 16px;
    font-weight: 600;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f1;
}

.summary-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    font-weight: bold;
    font-size: 16px;
}

.summary-label {
    color: #666;
}

.summary-value {
    color: #23282d;
    font-weight: 500;
}

/* Purchase Button */
.purchase-button {
    width: 100%;
    padding: 15px 30px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.purchase-button:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,115,170,0.3);
}

.purchase-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.purchase-button.loading {
    position: relative;
    color: transparent;
}

.purchase-button.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: tbvs-spin 1s linear infinite;
}

/* Messages */
.certificate-message {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 16px;
}

.certificate-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.certificate-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.certificate-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Loading States */
.certificates-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.certificates-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: tbvs-spin 1s linear infinite;
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tbvs-certificate-sell {
        padding: 15px;
        margin: 10px;
    }
    
    .certificates-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .certificate-sell-header h2 {
        font-size: 24px;
    }
    
    .certificate-purchase-form {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .tbvs-certificate-sell {
        padding: 10px;
        margin: 5px;
    }
    
    .certificate-item {
        padding: 15px;
    }
    
    .certificate-image {
        height: 120px;
    }
    
    .certificate-title {
        font-size: 16px;
    }
    
    .certificate-price {
        font-size: 20px;
    }
    
    .purchase-button {
        padding: 12px 20px;
        font-size: 16px;
    }
}

/* Animation Keyframes */
@keyframes tbvs-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Certificate Selection Animation */
.certificate-item {
    animation: fadeIn 0.5s ease-out;
}

.certificate-item:nth-child(1) { animation-delay: 0.1s; }
.certificate-item:nth-child(2) { animation-delay: 0.2s; }
.certificate-item:nth-child(3) { animation-delay: 0.3s; }
.certificate-item:nth-child(4) { animation-delay: 0.4s; }

/* Form Validation */
.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: #d63638;
    box-shadow: 0 0 0 2px rgba(214,54,56,0.1);
}

.form-group .error-message {
    color: #d63638;
    font-size: 13px;
    margin-top: 5px;
    display: block;
}

/* Success State */
.certificate-purchase-success {
    text-align: center;
    padding: 40px 20px;
    background: #d4edda;
    border: 2px solid #c3e6cb;
    border-radius: 8px;
    color: #155724;
}

.certificate-purchase-success h3 {
    color: #155724;
    margin-bottom: 15px;
}

.certificate-purchase-success .success-icon {
    font-size: 48px;
    color: #00a32a;
    margin-bottom: 20px;
}

.certificate-download-link {
    display: inline-block;
    padding: 12px 25px;
    background: #00a32a;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    margin-top: 15px;
    font-weight: 600;
    transition: background 0.3s ease;
}

.certificate-download-link:hover {
    background: #007a2e;
    color: #fff;
}

/* No Certificates State */
.no-certificates {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-certificates .icon {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 20px;
}

.no-certificates h3 {
    color: #666;
    margin-bottom: 10px;
}

.no-certificates p {
    color: #999;
    font-size: 16px;
}

/* Certificate Sidebar */
.certificate-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 9999;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.certificate-sidebar.open {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.sidebar-header h3 {
    margin: 0;
    color: #23282d;
    font-size: 18px;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover {
    color: #000;
}

.sidebar-content {
    padding: 20px;
}

.selected-certificate h4 {
    margin: 0 0 15px 0;
    color: #23282d;
    font-size: 16px;
    font-weight: 600;
}

.certificate-summary {
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f1;
}

.summary-row:last-child {
    border-bottom: none;
    font-weight: bold;
    font-size: 16px;
}

.sidebar-actions {
    margin-top: 20px;
}

.btn-primary {
    background: #0073aa;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background: #005a87;
}

/* Success Message */
.certificate-success-message {
    background: #d1eddd;
    border: 1px solid #00a32a;
    border-radius: 6px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
}

.certificate-success-message p {
    margin: 0;
    color: #00a32a;
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .certificate-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .certificate-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .certificate-card {
        padding: 15px;
    }
}

.tbvs-btn-primary {
    background: #0073aa;
    color: white;
}

.tbvs-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.tbvs-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.tbvs-btn-secondary {
    background: #6c757d;
    color: white;
}

.tbvs-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Messages */
.tbvs-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
}

.tbvs-message-success {
    background: #28a745;
}

.tbvs-message-error {
    background: #dc3545;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile responsive for sidebar */
@media (max-width: 768px) {
    .tbvs-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .tbvs-sidebar-content {
        padding: 15px;
    }
    
    .tbvs-message {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
