/**
 * WooCodes Frontend Styles
 * 
 * @package WooCodes
 * @version 1.2.0
 */

/* ==========================================================================
   Thank You Page Styles
   ========================================================================== */

.woocodes-thankyou-container {
    margin: 30px 0;
    background: #f8fafc;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.woocodes-invoice-wrapper {
    padding: 40px 30px;
    text-align: center;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.woocodes-logo {
    margin-bottom: 25px;
}

.woocodes-logo img {
    max-width: 180px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.woocodes-title {
    font-weight: 800;
    margin-bottom: 20px;
    font-size: 28px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.woocodes-description {
    font-size: 18px;
    margin-bottom: 25px;
    color: #4b5563;
    line-height: 1.6;
}

/* ==========================================================================
   Codes Container
   ========================================================================== */

.woocodes-codes-container {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    padding: 25px;
    margin-bottom: 30px;
    text-align: left;
    border: 1px solid #e2e8f0;
}

.woocodes-product-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #e2e8f0;
}

.woocodes-product-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.woocodes-product-title {
    font-weight: 700;
    margin: 0 0 15px 0;
    font-size: 20px;
    text-align: left;
}

/* ==========================================================================
   Codes Grid
   ========================================================================== */

.woocodes-codes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.woocodes-code-item {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    position: relative;
}

.woocodes-code-item:hover {
    background: #e0f2fe;
    border-color: #0ea5e9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
}

.woocodes-code {
    flex: 1;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    font-size: 16px;
    color: #111827;
    background: transparent;
    border: none;
    padding: 0;
    letter-spacing: 0.5px;
    word-break: break-all;
}

.woocodes-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.2s ease;
    margin-left: 10px;
    flex-shrink: 0;
}

.woocodes-copy-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    transform: scale(1.1);
}

.woocodes-copy-btn:active {
    transform: scale(0.95);
}

/* ==========================================================================
   Footer Elements
   ========================================================================== */

.woocodes-footer-button {
    margin-bottom: 20px;
}

.woocodes-back-button {
    display: inline-block;
    padding: 14px 32px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    font-size: 16px;
    border: none;
    cursor: pointer;
}

.woocodes-back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    text-decoration: none;
}

.woocodes-back-button:active {
    transform: translateY(0);
}

.woocodes-support {
    margin-top: 25px;
}

.woocodes-support p {
    margin: 0;
    font-size: 15px;
    color: #64748b;
    line-height: 1.6;
}

.woocodes-support a {
    text-decoration: underline;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.woocodes-support a:hover {
    opacity: 0.8;
    text-decoration: none;
}

/* ==========================================================================
   Product Page Availability Notice
   ========================================================================== */

.woocodes-availability-notice {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
    font-size: 14px;
}

.woocodes-stock-info,
.woocodes-delivery-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-left: 4px;
    border-left: 3px solid;
}

.woocodes-stock-info {
    border-left-color: #10b981;
}

.woocodes-delivery-info {
    border-left-color: #3b82f6;
    margin-bottom: 0;
}

.woocodes-stock-info .woocodes-icon,
.woocodes-delivery-info .woocodes-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.woocodes-text {
    color: #374151;
    font-weight: 500;
}

.woocodes-low-stock {
    color: #dc2626;
    font-weight: 600;
    font-size: 12px;
}

/* ==========================================================================
   Copy Notification
   ========================================================================== */

.woocodes-copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    z-index: 10000;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    animation: woocodes-slideInRight 0.3s ease, woocodes-fadeOut 0.3s ease 1.7s;
    animation-fill-mode: forwards;
}

@keyframes woocodes-slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes woocodes-fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.woocodes-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.woocodes-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: woocodes-spin 1s linear infinite;
}

@keyframes woocodes-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .woocodes-invoice-wrapper {
        padding: 30px 20px;
    }
    
    .woocodes-title {
        font-size: 24px;
        flex-direction: column;
        gap: 5px;
    }
    
    .woocodes-description {
        font-size: 16px;
    }
    
    .woocodes-codes-grid {
        grid-template-columns: 1fr;
    }
    
    .woocodes-code-item {
        padding: 12px;
    }
    
    .woocodes-code {
        font-size: 14px;
    }
    
    .woocodes-back-button {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .woocodes-availability-notice {
        margin: 15px 0;
        padding: 12px;
    }
    
    .woocodes-stock-info,
    .woocodes-delivery-info {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .woocodes-thankyou-container {
        margin: 20px -15px;
        border-radius: 0;
    }
    
    .woocodes-invoice-wrapper {
        padding: 25px 15px;
    }
    
    .woocodes-codes-container {
        padding: 20px 15px;
    }
    
    .woocodes-product-title {
        font-size: 18px;
    }
    
    .woocodes-code {
        font-size: 13px;
    }
    
    .woocodes-copy-btn {
        padding: 6px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .woocodes-copy-btn {
        display: none;
    }
    
    .woocodes-back-button {
        display: none;
    }
    
    .woocodes-thankyou-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .woocodes-codes-container {
        box-shadow: none;
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
    .woocodes-code-item {
        border: 2px solid #000;
    }
    
    .woocodes-code {
        color: #000;
        background: #fff;
    }
    
    .woocodes-copy-btn:hover {
        background: #000;
        color: #fff;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .woocodes-code-item,
    .woocodes-copy-btn,
    .woocodes-back-button {
        transition: none;
    }
    
    .woocodes-code-item:hover {
        transform: none;
    }
    
    .woocodes-back-button:hover {
        transform: none;
    }
    
    .woocodes-copy-notification {
        animation: none;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .woocodes-thankyou-container {
        background: #1f2937;
        border-color: #374151;
    }
    
    .woocodes-invoice-wrapper {
        color: #f9fafb;
    }
    
    .woocodes-description {
        color: #d1d5db;
    }
    
    .woocodes-codes-container {
        background: #111827;
        border-color: #374151;
    }
    
    .woocodes-code-item {
        background: #1f2937;
        border-color: #374151;
    }
    
    .woocodes-code-item:hover {
        background: #2d3748;
        border-color: #4fd1c7;
    }
    
    .woocodes-code {
        color: #f9fafb;
    }
    
    .woocodes-support p {
        color: #9ca3af;
    }
    
    .woocodes-availability-notice {
        background: #1f2937;
        border-color: #374151;
    }
    
    .woocodes-text {
        color: #e5e7eb;
    }
}