/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

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

.header-text h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header-text p {
    font-size: 1rem;
    opacity: 0.9;
}

/* Login Section Styles */
.login-section {
    flex-shrink: 0;
}

.login-form {
    display: block;
}

.login-fields {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.login-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9rem;
    width: 100px;
    transition: all 0.3s ease;
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.login-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.login-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Admin Panel Styles */
.admin-panel {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    border-left: 4px solid #667eea;
}

.admin-panel h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.admin-section-content h3 {
    color: #495057;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Loading and Auth States */
.auth-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Header */
@media (max-width: 767px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }

    .header-text {
        text-align: center;
    }

    .login-fields {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .login-input {
        width: auto;
    }

    .user-info {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Main Content */
main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

/* Welcome Section */
.welcome-section {
    background: white;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.welcome-section h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.welcome-section p {
    color: #6c757d;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.admin-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.admin-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.admin-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    text-decoration: none;
    color: white;
}

.admin-icon {
    font-size: 1.5rem;
}

/* Section Styles */
section {
    margin-bottom: 2rem;
}

section h2 {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Form Styles - Compact Layout */
.add-recipe {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e9ecef;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background-color: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    color: #6c757d;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Rating Input Styles */
.rating-input {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.75rem;
    background-color: #f8f9fa;
}

.rating-input legend {
    font-weight: 600;
    color: #495057;
    padding: 0 0.4rem;
    font-size: 0.9rem;
}

.rating-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.rating-options input[type="radio"] {
    width: auto;
    margin: 0;
    margin-right: 0.25rem;
}

.rating-options label {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: #495057;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 16px;
    transition: all 0.3s ease;
    background-color: white;
    border: 1px solid #dee2e6;
    margin: 0;
}

.rating-options label:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.rating-options input[type="radio"]:checked+label {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* Button Styles */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.3px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Message Styles */
.message {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
    display: none;
    font-size: 0.9rem;
}

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

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

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

/* Recipe List Styles */
.recipe-list {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

/* Recipe Controls */
.recipe-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.search-container {
    position: relative;
    flex: 1;
}

.search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: none;
}

.clear-search-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

.clear-search-btn.show {
    display: block;
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-container label {
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.sort-select {
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.sort-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.recipes-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Recipe Card Styles - User Friendly Layout */
.recipe-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 0.75rem;
}

.recipe-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.recipe-card.hidden {
    display: none;
}

.recipe-card-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

/* Recipe Image Styles */
.recipe-image-container {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

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

.recipe-image:hover {
    transform: scale(1.05);
}

.recipe-image-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.image-placeholder-icon {
    font-size: 1.5rem;
    color: #6c757d;
    opacity: 0.7;
}

.recipe-image-error {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #6c757d;
    text-align: center;
    padding: 0.25rem;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.recipe-title-section {
    flex: 1;
    min-width: 0;
}

.recipe-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.recipe-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    word-break: break-word;
    cursor: pointer;
}

.recipe-link:hover {
    color: #5a67d8;
    text-decoration: underline;
}

.recipe-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 4px;
}

.recipe-domain-container {
    margin-top: 0.25rem;
}

.recipe-domain {
    font-size: 0.8rem;
    color: #6c757d;
    background-color: #f8f9fa;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    white-space: nowrap;
    display: inline-block;
}

.recipe-memo {
    background-color: #f8f9fa;
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.memo-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.memo-text {
    color: #495057;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
    word-break: break-word;
}

.recipe-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f3f4;
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .recipe-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .recipe-meta {
        justify-content: space-between;
        order: 1;
    }

    .edit-btn {
        order: 2;
        align-self: center;
    }
}

.recipe-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    flex-wrap: wrap;
}

.recipe-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #6c757d;
    cursor: help;
}

.date-icon {
    font-size: 0.8rem;
}

.recipe-rating {
    display: flex;
    align-items: center;
}

.star-rating.compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.star-rating.compact .stars {
    display: flex;
    gap: 0.1rem;
}

.star-rating.compact .star {
    font-size: 0.9rem;
    line-height: 1;
}

.star-rating.compact .star.filled {
    color: #ffc107;
}

.star-rating.compact .star.empty {
    color: #e9ecef;
}

.star-rating.compact .rating-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}





.recipe-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    flex: 1;
    min-width: 0;
}

.recipe-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    word-break: break-word;
    cursor: pointer;
}

.recipe-link:hover {
    color: #764ba2;
    text-decoration: underline;
    transform: translateY(-1px);
}

.recipe-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 4px;
}

.recipe-link:active {
    color: #5a4fcf;
    transform: translateY(0);
}



.recipe-url {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
    display: inline-block;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.recipe-url:hover {
    color: #764ba2;
    text-decoration: underline;
}

.recipe-memo {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-style: italic;
    color: #495057;
    border-left: 4px solid #667eea;
}

.recipe-memo:empty {
    display: none;
}

/* Star Rating Display */
.stars {
    display: flex;
    gap: 0.25rem;
}

.star {
    font-size: 1.2rem;
    color: #ffc107;
}

.star.empty {
    color: #e9ecef;
}

.rating-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Recipe Card Actions */
/* Delete Button Styles */
.delete-btn {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    opacity: 0.7;
}

.delete-btn:hover {
    background-color: #dc3545;
    color: white;
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.delete-btn:focus {
    outline: 2px solid #dc3545;
    outline-offset: 2px;
    opacity: 1;
}

.delete-btn:active {
    transform: scale(0.95);
}

.delete-icon {
    font-weight: bold;
    line-height: 1;
}



.edit-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    background: none;
}

.edit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.edit-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.edit-icon {
    font-size: 0.8rem;
}

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

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

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.empty-state p:last-child {
    font-size: 0.95rem;
    opacity: 0.8;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

footer p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Responsive Design - Tablet */
@media (min-width: 768px) {
    header h1 {
        font-size: 2.2rem;
    }

    header p {
        font-size: 1.1rem;
    }

    main {
        padding: 3rem 2rem;
    }

    .add-recipe {
        padding: 1.5rem;
        max-width: 600px;
        margin: 0 auto 2rem;
    }

    .recipe-list {
        padding: 2rem;
    }

    .recipe-controls {
        flex-direction: row;
        align-items: flex-end;
    }

    .search-container {
        flex: 2;
    }

    .sort-container {
        flex: 1;
        min-width: 200px;
    }

    .rating-options {
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .btn-primary {
        width: auto;
        min-width: 180px;
        align-self: flex-start;
        padding: 0.75rem 1.25rem;
    }

    .recipe-card-header {
        flex-wrap: nowrap;
    }

    .recipe-actions {
        flex-wrap: nowrap;
    }

    .btn-secondary,
    .btn-danger {
        flex: 0 1 auto;
        min-width: 100px;
    }

    /* Larger images on tablet and desktop */
    .recipe-image-container,
    .recipe-image-placeholder {
        width: 100px;
        height: 100px;
    }
}

/* Responsive Design - Desktop */
@media (min-width: 1024px) {
    header {
        padding: 2.5rem 2rem;
    }

    header h1 {
        font-size: 2.3rem;
    }

    main {
        padding: 3rem 2rem;
    }

    .add-recipe {
        max-width: 650px;
        margin: 0 auto 2.5rem;
        padding: 1.75rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.7rem;
    }

    .btn-primary {
        padding: 0.8rem 1.5rem;
        font-size: 1.05rem;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .recipes-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* High Contrast and Accessibility */
@media (prefers-contrast: high) {
    .recipe-card {
        border-width: 3px;
    }

    .form-group input,
    .form-group textarea {
        border-width: 3px;
    }
}

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

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {

    .btn-primary,
    .edit-btn,
    .btn-secondary,
    .btn-danger {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    .delete-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .rating-options label {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    .recipe-url {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .recipe-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.25rem 0;
        text-decoration: underline;
    }
}

/* Print Styles */
@media print {

    header,
    footer,
    .add-recipe,
    .recipe-actions {
        display: none;
    }

    .recipe-card {
        break-inside: avoid;
        border: 2px solid #000;
        margin-bottom: 1rem;
    }

    .recipe-url {
        color: #000;
        text-decoration: underline;
    }

    .recipe-link {
        color: #000;
        text-decoration: underline;
    }
}

/* Res
ponsive improvements for tablet and desktop */
@media (min-width: 768px) {
    .recipe-footer {
        flex-wrap: nowrap;
    }

    .recipe-meta {
        gap: 1.5rem;
        flex-wrap: nowrap;
    }



    .recipe-date {
        font-size: 0.9rem;
    }

    .star-rating.compact .rating-label {
        font-size: 0.85rem;
    }

    .recipe-card {
        padding: 1.5rem;
    }

    .recipe-title {
        font-size: 1.2rem;
    }

    .memo-text {
        font-size: 1rem;
    }
}

@media (min-width: 1024px) {
    .recipe-card {
        padding: 1.75rem;
    }

    .recipe-footer {
        padding-top: 0.75rem;
    }

    .recipe-meta {
        gap: 2rem;
    }
}

/* URL Preview Styles */
.url-preview-container {
    margin-top: 0.75rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    background: white;
    animation: slideDown 0.3s ease-out;
}

.url-preview-container.loading {
    background: #f8f9fa;
}

.url-preview-container.error {
    background: #fff5f5;
    border-color: #fed7d7;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.url-preview {
    display: flex;
    padding: 1rem;
    gap: 1rem;
    position: relative;
}

.url-preview-image-container {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.url-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.url-preview-no-image {
    font-size: 1.5rem;
    color: #6c757d;
    opacity: 0.7;
}

.url-preview-content {
    flex: 1;
    min-width: 0;
}

.url-preview-title {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-preview-domain {
    margin: 0 0 0.5rem 0;
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}

.url-preview-description {
    margin: 0;
    font-size: 0.85rem;
    color: #495057;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.url-preview-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6c757d;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.url-preview-close:hover {
    background: #e9ecef;
    color: #495057;
}

.url-preview-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    color: #6c757d;
}

.url-preview-loading .loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.url-preview-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    color: #721c24;
    position: relative;
}

.url-preview-error .error-icon {
    font-size: 1.1rem;
}

/* Responsive URL Preview */
@media (max-width: 767px) {
    .url-preview {
        flex-direction: column;
        padding: 0.75rem;
    }

    .url-preview-image-container {
        width: 60px;
        height: 60px;
        align-self: flex-start;
    }

    .url-preview-title {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
}

/* Enhanced Recipe Image Styles for Better Link Preview */
.recipe-image-container {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.recipe-image-container:hover {
    transform: scale(1.02);
}

.recipe-image {
    transition: opacity 0.3s ease;
}

.recipe-image:hover {
    opacity: 0.9;
}

/* Loading state for recipe images */
.recipe-image[src=""] {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recipe-image[src=""]:before {
    content: "🍽️";
    font-size: 1.5rem;
    color: #6c757d;
    opacity: 0.7;
}

/* Enhanced image error handling */
.recipe-image-error {
    background: #f8f9fa;
    color: #6c757d;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.5rem;
    border: 1px dashed #dee2e6;
    border-radius: 4px;
}

/* Better placeholder styling */
.recipe-image-placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.recipe-image-placeholder:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: scale(1.02);
}

.image-placeholder-icon {
    transition: transform 0.2s ease;
}

.recipe-image-placeholder:hover .image-placeholder-icon {
    transform: scale(1.1);
}

/* Enhanc
ed URL Preview Styles for Existing Recipes */
.url-preview.existing-recipe {
    border: 2px solid #28a745;
    background: #f8fff9;
}

.url-preview-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.existing-badge {
    background: #28a745;
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.url-preview.existing-recipe .url-preview-title {
    color: #155724;
    font-weight: 600;
}

.url-preview.existing-recipe .url-preview-description {
    color: #155724;
    font-style: italic;
}

/* Loading spinner animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}