/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 容器 */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 无padding容器 - Reverted to 100% for full width sections */
.container-no-padding {
    /* max-width: 800px; - Reverted */
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* main-content 内部的 container */
.main-content .container {
    padding: 0 10px;
}

/* 分类标签 */
/* Tabs Wrapper for 100% Band */
.tabs-wrapper {
    background-color: #fff;
    width: 100%;
    border-bottom: 1px solid #eee;
    /* Optional visual separation */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Shadow moves here */
    margin-bottom: 20px;
}

/* 分类标签 Inner Container */
.category-tabs {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    /* justify-content: center; */
    padding: 15px 0;
    /* background-color: #fff; Removed, handled by wrapper */
    margin: 0 auto;
    /* Center the container itself */
    max-width: 800px;
    /* Constraint content */
    /* box-shadow: ...; Removed */
    -webkit-overflow-scrolling: touch;
    width: 100%;
    white-space: nowrap;
}

/* .category-tabs::-webkit-scrollbar { display: none; } Removed */

/* Header Styling */
/* Header Styling - Connected to Tabs */
/* Header Styling */
header {
    text-align: center;
    background-color: #fff;
    padding: 10px 0;
    margin-bottom: 20px;
    /* Default spacing for non-home pages */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    /* Faint separator line */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

header.header-connected {
    margin-bottom: 0;
    /* No gap for connected tabs */
    /* Keep the border as requested for distinction, or remove if "seamless" wanted. 
       User said: "要有一条较淡的分割线，这样首页和标签模块也有区分度" -> Keep border. */
}

header h1 {
    max-width: 800px;
    margin: 0 auto;
    line-height: 0;
    /* Removing extra line-height space for image */
}

.site-logo {
    max-height: 56px;
    /* User requested 56px */
    width: auto;
    vertical-align: middle;
}

.site-slogan {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
    letter-spacing: 1px;
}

/* 分类标签项基础样式 */
.category-tab {
    flex-shrink: 0;
    padding: 9px 16px;
    /* Optimized for 38px height */
    margin: 0 4px;
    background-color: #f0f0f0;
    border-radius: 19px;
    /* Half of 38px */
    font-size: 14px;
    line-height: 20px;
    /* Explicit line-height */
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Center tabs when they fit, scroll when they don't */
.category-tab:first-child {
    margin-left: auto;
}

.category-tab:last-child {
    margin-right: auto;
}

/* 响应式设计 - 手机端优化 */
@media (max-width: 768px) {
    .category-tabs {
        justify-content: flex-start;
        padding: 10px 5px;
    }
}

@media (max-width: 480px) {
    .category-tabs {
        padding: 10px 5px;
        margin: 0 0 0 0;
    }

    .category-tab {
        padding: 7px 14px;
        /* Optimized for 34px height */
        margin: 0 4px;
        font-size: 13px;
        line-height: 20px;
        border-radius: 17px;
        /* Half of 34px */
    }
}

.category-tab:hover,
.category-tab.active {
    background-color: #4a90e2;
    color: #fff;
}

/* 图片列表 */
.image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 80px;
}

.image-item {
    background-color: transparent;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    transition: transform 0.3s ease;
}

.image-item:hover {
    transform: translateY(-3px);
    box-shadow: none;
}

.image-item a {
    display: block;
    text-decoration: none;
    color: #333;
}

.image-item img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 8px;
    /* Subtle radius */
}

.image-item:hover img {
    transform: translateY(-2px);
}

.image-info {
    display: none;
}

/* 生成页面样式 */
.generate-container {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 250px;
    /* More space for fixed controls if needed, generally useful */
}

.generate-section {
    background-color: #fff;
    border-radius: 8px;
    /* Subtle radius */
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    line-height: 1.2;
}

.section-title i {
    margin-right: 5px;
}

.image-grid.fixed-4-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 0;
}

.generate-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
    padding: 0;
    /* Aligned with the White Sections (cards) themselves, not the inner grid */
}

.controls-row {
    display: flex;
    gap: 16px;
    width: 100%;
}

.image-select-btn-container,
.aspect-ratio-selector-container {
    flex: 1;
    /* 50% split */
    position: relative;
    width: 50%;
    /* Ensuring equal width */
}

/* Image Select Button */
.image-select-btn,
.aspect-ratio-btn {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 0 16px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    width: 100%;
    height: 52px;
    /* Consistent Height */
    color: #555;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.image-select-btn:hover,
.aspect-ratio-btn:hover {
    background-color: #f8f9fa;
    border-color: #ccc;
    transform: translateY(-1px);
}

/* Preview Thumbnail Floating Style */
/* Preview Thumbnail Floating Style */
.selected-image-preview {
    position: absolute;
    bottom: 70px;
    /* Adjusted for larger size + arrow */
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 120px;
    /* 3:4 aspect ratio */
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 3px solid #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 20;
    display: none;
    pointer-events: none;
}

/* Triangle Arrow */
.selected-image-preview::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

.selected-image-preview.show {
    display: block;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translate(-50%, 10px) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

.aspect-ratio-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 120px;
    z-index: 100;
    display: none;
}

.aspect-ratio-menu::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: #ddd transparent transparent transparent;
}

.aspect-menu-item {
    display: block;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
}

.aspect-menu-item:hover {
    background-color: #f0f0f0;
}

.aspect-menu-item input[type="radio"] {
    display: none;
}

.aspect-menu-item input[type="radio"]:checked+span {
    font-weight: bold;
    color: #646cff;
}

.base-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.upload-image-item {
    width: 100%;
    aspect-ratio: 3/4;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: transparent;
}

.upload-image-item:hover {
    border-color: #4a90e2;
    background-color: transparent;
}

.upload-icon {
    font-size: 40px;
    color: #999;
    transition: color 0.3s ease;
}

.upload-image-item:hover .upload-icon {
    color: #4a90e2;
}

.uploaded-image-item {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: none;
}

.uploaded-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: rgba(255, 0, 0, 0.8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.remove-image-btn:hover {
    background-color: rgba(255, 0, 0, 1);
    transform: scale(1.1);
}

.sample-images-grid,
.result-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.sample-image-item,
.result-image-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

.sample-image-item:hover,
.result-image-item:hover {
    transform: scale(1.05);
}

.sample-image-item img,
.result-image-item img {
    width: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.aspect-1-1 img {
    aspect-ratio: 1/1;
}

.aspect-3-5 img {
    aspect-ratio: 3/5;
}

.aspect-9-16 img {
    aspect-ratio: 9/16;
}

.aspect-3-4 img {
    aspect-ratio: 3/4;
}

/* Generate Button */
.generate-btn {
    width: 100%;
    height: 52px;
    padding: 0 20px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: #fff;
    border: none;
    border-radius: 26px;
    /* Pill shape */
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    /* Added spacing */
    margin-bottom: 90px;
    /* Added spacing */
    z-index: 5;
    position: relative;
    /* Ensure visibility */
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

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

/* Lightbox Styles */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.lightbox-content-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    /* Max display width */
    text-align: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

.lightbox-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.lightbox-btn {
    padding: 10px 25px;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-btn {
    background-color: #fff;
    color: #333;
}

.download-btn:hover {
    background-color: #f0f0f0;
    transform: scale(1.05);
}

.close-lightbox-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.close-lightbox-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Lightbox Navigation */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    /* Darker background for visibility */
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* Border as requested */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 1001;
    /* Above image */
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

/* 记录页面样式 */
.record-list {
    margin-bottom: 0px;
}

.pagination-container {
    margin-bottom: 100px;
}

.record-item {
    background-color: transparent;
    border-radius: 0;
    padding: 10px 0;
    margin-bottom: 15px;
    box-shadow: none;
}

.record-images {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.record-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.record-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.record-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.record-meta {
    font-size: 12px;
    color: #666;
}

.record-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.regenerate-btn {
    background-color: #4a90e2;
    color: #fff;
    border: none;
}

.delete-btn {
    background-color: #e74c3c;
    color: #fff;
    border: none;
}

/* 个人中心页面样式 */
.user-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 10px;
    margin-bottom: 80px;
}

.user-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-info {
    text-align: center;
}

.user-points {
    font-size: 36px;
    font-weight: 700;
    color: #4a90e2;
    margin: 10px 0;
}

.user-detail {
    font-size: 14px;
    color: #666;
    margin: 5px 0;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    font-size: 12px;
    transition: color 0.3s ease;
}

.nav-item:hover,
.nav-item.active {
    color: #4a90e2;
}

.nav-item i {
    font-size: 24px;
    margin-bottom: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .record-image {
        flex: 0 0 auto;
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .record-images {
        gap: 10px;
    }

    .record-image {
        flex: 0 0 auto;
        width: 100px;
        height: 100px;
    }

    .record-info {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* 隐藏文件输入 */
#file-input {
    display: none;
}

/* 登录和注册页面样式 */
.auth-form-container,
.auth-container {
    background-color: #fff;
    border-radius: 16px;
    /* Premium aesthetics */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    /* Soft, elevated shadow */
    padding: 40px;
    /* More breathing room */
    max-width: 440px;
    margin: 40px auto 60px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.auth-form-container h2,
.auth-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

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

.auth-form-container .form-group label,
.auth-container .form-group label {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-weight: 500;
    font-size: 14px;
}

/* Unified Input Styling */
.auth-form-container .form-group input[type="text"],
.auth-form-container .form-group input[type="email"],
.auth-form-container .form-group input[type="password"],
.auth-container .form-group input[type="text"],
.auth-container .form-group input[type="email"],
.auth-container .form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    background-color: #fcfcfc;
    transition: all 0.3s ease;
    height: 48px;
    /* Comfortable touch target */
}

.auth-form-container .form-group input:focus,
.auth-container .form-group input:focus {
    border-color: #4a90e2;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    outline: none;
}

.auth-form-container .captcha-group,
.auth-container .captcha-group {
    display: block;
    /* Stack on small screens if needed, but flex is fine */
}

.captcha-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.captcha-image {
    height: 48px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #e0e0e0;
}

.captcha-hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

.auth-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 48px;
    margin-top: 10px;
}

.auth-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-link,
.auth-links {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: #666;
}

.auth-link a,
.auth-links a {
    color: #4a90e2;
    text-decoration: none;
    font-weight: 500;
}

.auth-link a:hover,
.auth-links a:hover {
    text-decoration: underline;
}

/* 消息提示样式 */
.success-message,
.error-message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
}

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

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

.error-messages {
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.error-messages ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.error-messages li {
    color: #c33;
    padding: 5px 0;
    font-size: 14px;
}

.error-messages li i {
    margin-right: 8px;
}

/* 认证链接样式 */
.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #666;
}

.auth-links a {
    color: #646cff;
    text-decoration: none;
    font-weight: 500;
}

/* Auth Form Compact Styles */
.auth-container {
    max-width: 400px;
    margin: 40px auto 110px;
    /* Corrected margin as requested */
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
    font-weight: 600;
}

.auth-form .form-group {
    margin-bottom: 10px;
    position: relative;
}

.auth-form label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.auth-form label i {
    width: 20px;
    text-align: center;
    color: #999;
    margin-right: 4px;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.auth-form input[type="text"]:focus,
.auth-form input[type="password"]:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.auth-button {
    width: 100%;
    padding: 8px;
    margin-top: 15px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.captcha-group .captcha-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.captcha-group input {
    flex: 1;
}

.captcha-image {
    height: 35px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #ddd;
}

.captcha-hint {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

.auth-link a:hover,
.auth-links a:hover {
    text-decoration: underline;
}

/* Custom Modal Styles */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Black w/ opacity */
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s;
    overflow: hidden;
}

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

.modal-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close-modal:hover,
.close-modal:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.modal-body {
    padding: 30px 20px;
    text-align: center;
    font-size: 16px;
    color: #666;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-cancel {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background-color: #f5f5f5;
}

.btn-confirm {
    padding: 8px 20px;
    border: none;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

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

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

/* Toast Notification Styles */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toastFadeIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    justify-content: center;
}

.toast.success {
    border-left: 4px solid #4cd964;
}

.toast.error {
    border-left: 4px solid #ff3b30;
}

.toast i {
    font-size: 16px;
}

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

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

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Mobile Fixes for Records Page */
.record-images {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.record-image {
    width: 100%;
    height: auto !important;
    /* Allow aspect-ratio to determine height */
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.record-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .record-images {
        grid-template-columns: repeat(2, 1fr);
        /* 2 cols on mobile */
        gap: 8px;
    }

    .record-image {
        /* Ensure height adheres to ratio */
        height: auto !important;
    }

    .record-list {
        padding: 0 10px;
        overflow-x: hidden;
    }

    /* Card Style for Mobile to fix visual ambiguity */
    .record-item {
        margin: 0 0 25px 0;
        padding: 15px;
        width: 100%;
        background-color: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }

    .record-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .record-meta {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 5px;
        padding-bottom: 10px;
        border-bottom: 1px solid #f5f5f5;
        /* Visual separator */
    }

    /* Override inline margins from PHP */
    .record-meta span {
        margin-left: 0 !important;
        margin-right: 12px;
        font-size: 12px;
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 4px;
        color: #666;
    }

    .record-meta .status-badge,
    .record-meta .status-badge span {
        color: #fff !important;
        /* Ensure status text is white */
        margin-right: 0 !important;
        /* Reset right margin for badge if needed, or keep it */
    }

    .record-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        /* Clean right alignment */
        margin-top: 0;
    }

    .action-btn {
        padding: 8px 16px;
        /* Larger touch target */
        font-size: 13px;
    }
}