/**
 * Certificate Converter Specific Styles - COMPLETELY REDESIGNED v2.1
 * 
 * @package CSR_Tools
 * @since 2.0.0
 * @updated 2.1.0 - Matching CSR Decoder professional style
 * 
 * FEATURES:
 * - Purple/violet theme (#8b5cf6)
 * - Professional card layouts
 * - Smooth animations
 * - Responsive design
 * - Print styles
 */

/* ==========================================================================
   Form Selection Buttons
   ========================================================================== */
#from-format,
#to-format {
    transition: all 0.3s ease;
}

#from-format:focus,
#to-format:focus {
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 0.25rem rgba(139, 92, 246, 0.15);
}

#from-format option:hover,
#to-format option:hover {
    background: #f3e7ff;
}

/* ==========================================================================
   File Upload Areas
   ========================================================================== */
.file-upload-area {
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.file-upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.1), transparent);
    transition: left 0.5s ease;
}

.file-upload-area:hover {
    border-color: #8b5cf6 !important;
    background: #f3e7ff !important;
    transform: scale(1.01);
}

.file-upload-area:hover::before {
    left: 100%;
}

.file-upload-area.drag-over {
    border-color: #8b5cf6 !important;
    background: #f3e7ff !important;
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.3);
}

/* Upload icon animation */
.upload-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.file-upload-area:hover .upload-icon {
    transform: scale(1.15) rotate(5deg);
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% {
        transform: scale(1.15) rotate(5deg) translateY(0);
    }
    50% {
        transform: scale(1.15) rotate(5deg) translateY(-10px);
    }
}

/* ==========================================================================
   File Input Visibility Logic
   ========================================================================== */
.file-input {
    animation: slideIn 0.4s ease;
    margin-bottom: 24px;
}

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

/* ==========================================================================
   Requirements Display
   ========================================================================== */
#requirements-display {
    animation: fadeInDown 0.4s ease;
}

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

#requirements-list {
    font-size: 14px;
    margin-top: 12px;
}

#requirements-list ul {
    margin: 8px 0 0 0;
    padding-left: 24px;
}

#requirements-list li {
    margin-bottom: 6px;
    color: #495057;
}

#requirements-list .required-file {
    color: #dc3545;
    font-weight: 700;
}

#requirements-list .optional-file {
    color: #6c757d;
    font-style: italic;
}

/* ==========================================================================
   Password Field Enhancements
   ========================================================================== */
#conversion-password {
    transition: all 0.3s ease;
}

#conversion-password:focus {
    border-color: #ffc107 !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.15);
}

.input-group-text {
    border: 2px solid #dee2e6;
    transition: all 0.3s ease;
}

#conversion-password:focus + .input-group-text,
.input-group:focus-within .input-group-text {
    border-color: #ffc107;
}

/* Password toggle button */
.input-group .btn-outline-secondary {
    border: 2px solid #dee2e6;
    transition: all 0.3s ease;
}

.input-group .btn-outline-secondary:hover {
    background: #f8f9fa;
    border-color: #8b5cf6;
    color: #8b5cf6;
}

/* ==========================================================================
   Result Container Animation
   ========================================================================== */
.result-container {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.6s ease, max-height 0.6s ease;
    margin-top: 40px;
}

.result-container.show {
    opacity: 1 !important;
    max-height: 500000px !important;
    overflow: visible !important;
    display: block !important;
}

/* Result cards stagger animation */
.result-container.show .card {
    animation: cardSlideIn 0.5s ease forwards;
    opacity: 0;
}

.result-container.show .card:nth-child(1) { animation-delay: 0.1s; }
.result-container.show .card:nth-child(2) { animation-delay: 0.2s; }
.result-container.show .card:nth-child(3) { animation-delay: 0.3s; }

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

/* ==========================================================================
   Submit Button Enhancements
   ========================================================================== */
button[type="submit"] {
    position: relative;
    overflow: hidden;
}

button[type="submit"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button[type="submit"]:hover::before {
    width: 400px;
    height: 400px;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.5) !important;
}

button[type="submit"]:active {
    transform: translateY(0);
}

/* ==========================================================================
   Quick Action Buttons
   ========================================================================== */
.clear-form-btn {
    transition: all 0.3s ease;
}

.clear-form-btn:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
    transform: translateY(-2px);
}

.btn-sm {
    transition: all 0.2s ease;
}

.btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Format Guide Cards
   ========================================================================== */
.format-guide-card {
    transition: all 0.3s ease;
    height: 100%;
}

.format-guide-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Conversion Matrix Table
   ========================================================================== */
.table-bordered {
    border-color: #dee2e6;
}

.table-bordered th,
.table-bordered td {
    border-color: #dee2e6;
}

.table-bordered thead th {
    font-weight: 700;
    text-align: center;
}

.table-bordered tbody td {
    text-align: center;
    font-weight: 600;
    transition: all 0.2s ease;
}

.table-bordered tbody tr:hover {
    background-color: rgba(139, 92, 246, 0.05);
}

.table-bordered tbody td[style*="background: #d4edda"] {
    color: #155724;
}

.table-bordered tbody td[style*="background: #f8d7da"] {
    color: #721c24;
}

/* ==========================================================================
   Alert Boxes
   ========================================================================== */
.alert {
    animation: alertSlideIn 0.5s ease;
}

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

/* ==========================================================================
   Sidebar Cards
   ========================================================================== */
.list-group-item {
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.list-group-item:hover {
    border-left-color: #8b5cf6;
    padding-left: 20px;
    transform: translateX(4px);
}

.list-group-item:active {
    transform: translateX(6px);
}

/* ==========================================================================
   Card Hover Effects
   ========================================================================== */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

.card-header {
    position: relative;
    overflow: hidden;
}

.card-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: headerShine 10s linear infinite;
}

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

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    backdrop-filter: blur(4px);
}

.loading-overlay .spinner-border {
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Success/Error Messages
   ========================================================================== */
.success-message,
.error-message {
    animation: messageSlideIn 0.5s ease;
}

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

.success-message .icon,
.error-message .icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.success-message:hover .icon,
.error-message:hover .icon {
    transform: scale(1.1) rotate(5deg);
}

/* ==========================================================================
   File Selected Info
   ========================================================================== */
.file-selected-info {
    animation: slideInDown 0.4s ease;
}

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

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast {
    animation: toastSlideIn 0.3s ease;
}

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

.toast.show {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Download Links
   ========================================================================== */
.download-link {
    display: inline-flex;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin: 8px 8px 8px 0;
}

.download-link:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.download-link .icon {
    font-size: 24px;
    margin-right: 10px;
}

/* ==========================================================================
   Info Tables
   ========================================================================== */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.info-table tr {
    border-bottom: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.info-table tr:hover {
    background-color: rgba(139, 92, 246, 0.05);
    transform: translateX(4px);
}

.info-table td {
    padding: 14px 12px;
    line-height: 1.6;
    vertical-align: top;
}

.info-table td:first-child {
    font-weight: 600;
    color: #6c757d;
    width: 180px;
}

.info-table code {
    font-size: 12px;
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #8b5cf6;
    font-weight: 600;
}

/* ==========================================================================
   Badge Enhancements
   ========================================================================== */
.badge {
    font-weight: 700;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
}

.badge:hover {
    transform: scale(1.05);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 991px) {
    .col-lg-4 {
        order: 2;
    }
    
    .col-lg-8 {
        order: 1;
    }
    
    .row.g-3 > .col-md-2 {
        display: none;
    }
    
    .row.g-3 > .col-md-5 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 767px) {
    .file-upload-area {
        padding: 24px 16px !important;
    }
    
    .upload-icon {
        font-size: 48px !important;
    }
    
    button[type="submit"] {
        font-size: 18px !important;
        padding: 16px !important;
    }
    
    .card-header h2 {
        font-size: 24px !important;
    }
    
    .card-body {
        padding: 24px 16px !important;
    }
    
    .table-responsive {
        font-size: 13px;
    }
    
    .format-guide-card {
        margin-bottom: 16px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .btn,
    .loading-overlay,
    #cert-converter-form,
    .col-lg-4,
    .file-upload-area,
    .clear-form-btn,
    .alert:not(.result-container .alert) {
        display: none !important;
    }
    
    .col-lg-8 {
        width: 100% !important;
    }
    
    #convert-result {
        display: block !important;
    }
    
    .result-container.show .card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
        margin-bottom: 20px;
    }
    
    .card-header {
        background: #f8f9fa !important;
        color: #222222 !important;
        border-bottom: 2px solid #dee2e6;
    }
    
    /* Print header */
    .result-container::before {
        content: 'CERTIFICATE CONVERSION REPORT';
        display: block;
        padding: 20px;
        background: #f8f9fa;
        border-bottom: 3px solid #8b5cf6;
        margin-bottom: 20px;
        font-weight: 800;
        font-size: 24px;
        text-align: center;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
button:focus-visible,
.btn:focus-visible {
    outline: 3px solid #8b5cf6;
    outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid #8b5cf6;
    outline-offset: 2px;
}

.form-control:focus,
.form-select:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 0.25rem rgba(139, 92, 246, 0.15);
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #222222 !important;
    }
    
    .badge {
        border: 2px solid currentColor;
    }
    
    .btn {
        border: 2px solid currentColor !important;
    }
    
    .table tbody tr:hover {
        background-color: #e9ecef !important;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Dark Mode Support (Optional)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .card {
        background: #2c2c2c;
        color: #e5e5e5;
        border-color: #444444;
    }
    
    .card-header {
        border-bottom-color: #444444;
    }
    
    .table {
        color: #e5e5e5;
    }
    
    .table tbody tr:hover {
        background-color: rgba(139, 92, 246, 0.2);
    }
    
    .file-upload-area {
        background: #1a1a1a !important;
        border-color: #444444 !important;
    }
    
    .form-control,
    .form-select {
        background: #1a1a1a;
        color: #e5e5e5;
        border-color: #444444;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-gradient-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow-purple {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.border-gradient-purple {
    border: 2px solid;
    border-image: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%) 1;
}

/* ==========================================================================
   Icon Animations
   ========================================================================== */
.card-header span[style*="font-size: 28px"],
.card-header span[style*="font-size: 36px"] {
    display: inline-block;
    transition: transform 0.3s ease;
}

.card:hover .card-header span[style*="font-size: 28px"],
.card:hover .card-header span[style*="font-size: 36px"] {
    transform: rotate(5deg) scale(1.1);
}

/* ==========================================================================
   Form Validation States
   ========================================================================== */
.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-control:valid,
.was-validated .form-select:valid {
    border-color: #28a745;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* ==========================================================================
   Conversion Arrow Animation
   ========================================================================== */
.row.g-3 > .col-md-2 span {
    display: inline-block;
    animation: arrowPulse 2s ease-in-out infinite;
}

@keyframes arrowPulse {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(8px);
    }
}

/* ==========================================================================
   Rate Limit Warning
   ========================================================================== */
.alert-warning.d-flex {
    animation: warningPulse 3s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
    }
    50% {
        box-shadow: 0 4px 16px rgba(255, 193, 7, 0.4);
    }
}

/* ==========================================================================
   Smooth Scrolling
   ========================================================================== */
html {
    scroll-behavior: smooth;
}

/* ==========================================================================
   Focus Indicators
   ========================================================================== */
*:focus-visible {
    outline: 3px solid #8b5cf6;
    outline-offset: 2px;
}