/**
 * Frontend styles for Cookie Calculator API
 */

/* =============================================================================
   Cookie List Shortcode
   ========================================================================== */
.cca-cookie-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.cca-cookie-item {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cca-cookie-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cca-cookie-item.inactive {
    opacity: 0.6;
    filter: grayscale(50%);
}

/* =============================================================================
   Cookie Image
   ========================================================================== */
.cca-cookie-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cca-cookie-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cca-cookie-item:hover .cca-cookie-image img {
    transform: scale(1.05);
}

/* =============================================================================
   Cookie Content
   ========================================================================== */
.cca-cookie-content {
    padding: 20px;
}

.cca-cookie-name {
    font-size: 1.25em;
    font-weight: bold;
    margin: 0 0 10px;
    color: #2c3e50;
    line-height: 1.3;
}

.cca-cookie-short-description {
    font-size: 0.95em;
    color: #6c757d;
    margin: 0 0 12px;
    line-height: 1.4;
    font-style: italic;
}

.cca-cookie-description {
    font-size: 0.9em;
    color: #495057;
    margin: 0 0 15px;
    line-height: 1.5;
}

.cca-cookie-description p {
    margin: 0 0 10px;
}

.cca-cookie-description p:last-child {
    margin-bottom: 0;
}

/* =============================================================================
   Cookie Price
   ========================================================================== */
.cca-cookie-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    margin-top: 15px;
}

.cca-price-label {
    font-size: 0.9em;
    color: #6c757d;
    font-weight: 500;
}

.cca-price-amount {
    font-size: 1.1em;
    font-weight: bold;
    color: #28a745;
}

/* =============================================================================
   No Cookies Message
   ========================================================================== */
.cca-no-cookies {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 20px 0;
}

/* =============================================================================
   Loading State
   ========================================================================== */
.cca-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
}

.cca-loading::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: cca-spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes cca-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================================================
   Responsive Design
   ========================================================================== */
@media screen and (max-width: 768px) {
    .cca-cookie-list {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 15px;
        margin: 15px 0;
    }
    
    .cca-cookie-image {
        height: 180px;
    }
    
    .cca-cookie-content {
        padding: 15px;
    }
    
    .cca-cookie-name {
        font-size: 1.15em;
    }
}

@media screen and (max-width: 480px) {
    .cca-cookie-list {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 12px 0;
    }
    
    .cca-cookie-image {
        height: 160px;
    }
    
    .cca-cookie-content {
        padding: 12px;
    }
    
    .cca-cookie-name {
        font-size: 1.1em;
        margin-bottom: 8px;
    }
    
    .cca-cookie-short-description {
        margin-bottom: 10px;
    }
    
    .cca-cookie-description {
        margin-bottom: 12px;
    }
    
    .cca-cookie-price {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding-top: 12px;
        margin-top: 12px;
    }
}

/* =============================================================================
   Print Styles
   ========================================================================== */
@media print {
    .cca-cookie-list {
        display: block;
        margin: 0;
    }
    
    .cca-cookie-item {
        display: block;
        margin-bottom: 20px;
        break-inside: avoid;
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .cca-cookie-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    .cca-cookie-image {
        height: auto;
        max-height: 150px;
    }
    
    .cca-cookie-image img {
        transform: none;
    }
    
    .cca-cookie-content {
        padding: 10px;
    }
    
    .cca-cookie-name {
        color: #000;
    }
    
    .cca-cookie-description,
    .cca-cookie-short-description {
        color: #333;
    }
    
    .cca-price-amount {
        color: #000;
    }
}

/* =============================================================================
   Accessibility Improvements
   ========================================================================== */
.cca-cookie-item:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.cca-cookie-name:focus,
.cca-cookie-image:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cca-cookie-item {
        border-color: #000;
    }
    
    .cca-cookie-name {
        color: #000;
    }
    
    .cca-cookie-description,
    .cca-cookie-short-description {
        color: #333;
    }
    
    .cca-price-label {
        color: #333;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cca-cookie-item,
    .cca-cookie-image img {
        transition: none;
    }
    
    .cca-cookie-item:hover {
        transform: none;
    }
    
    .cca-cookie-item:hover .cca-cookie-image img {
        transform: none;
    }
    
    .cca-loading::before {
        animation: none;
        border: 2px solid #007cba;
    }
}

/* =============================================================================
   Dark Mode Support
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .cca-cookie-item {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .cca-cookie-name {
        color: #ecf0f1;
    }
    
    .cca-cookie-description {
        color: #bdc3c7;
    }
    
    .cca-cookie-short-description {
        color: #95a5a6;
    }
    
    .cca-price-label {
        color: #95a5a6;
    }
    
    .cca-price-amount {
        color: #2ecc71;
    }
    
    .cca-cookie-price {
        border-top-color: #34495e;
    }
    
    .cca-no-cookies {
        background: #34495e;
        border-color: #2c3e50;
        color: #95a5a6;
    }
    
    .cca-cookie-image {
        background: #34495e;
    }
}

/* =============================================================================
   Theme Compatibility
   ========================================================================== */

/* Twenty Twenty-One compatibility */
.wp-block-group .cca-cookie-list,
.entry-content .cca-cookie-list {
    margin-left: 0;
    margin-right: 0;
}

/* Twenty Twenty-Two compatibility */
.wp-site-blocks .cca-cookie-list {
    margin-left: auto;
    margin-right: auto;
    max-width: none;
}

/* Gutenberg block editor compatibility */
.block-editor-block-list__layout .cca-cookie-list {
    margin-left: 0;
    margin-right: 0;
}

/* =============================================================================
   Utility Classes
   ========================================================================== */
.cca-text-center {
    text-align: center;
}

.cca-text-left {
    text-align: left;
}

.cca-text-right {
    text-align: right;
}

.cca-hidden {
    display: none;
}

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