/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background-color: #ffffff;
}

/* Salmon-inspired color palette */
:root {
    --salmon-primary: #f05a5a;
    --salmon-secondary: #e74c3c;
    --salmon-accent: #f05a5a;
    --salmon-dark: #1a1a1a;
    --salmon-gray: #6b7280;
    --salmon-light-gray: #f3f4f6;
    --salmon-border: #e5e7eb;
    --salmon-success: #10b981;
    --salmon-error: #ef4444;
    --salmon-warning: #f59e0b;
    --salmon-info: #3b82f6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--salmon-dark);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
    color: var(--salmon-gray);
    line-height: 1.7;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main {
    min-height: 100vh;
    padding: 2rem 0;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--salmon-primary) 0%, var(--salmon-secondary) 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.nav a:hover {
    opacity: 0.8;
}

/* Main content */
.content-header {
    text-align: left;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}

.content-header h1 {
    color: var(--salmon-dark);
    margin-bottom: 1rem;
    font-size: 2.5rem;
    font-weight: 700;
}

.content-header p {
    color: var(--salmon-gray);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0;
}

/* Offers grid */
.offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Offer cards */
.offer-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--salmon-border);
}

.offer-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.offer-image-container {
    position: relative;
    height: 200px;
    background: var(--salmon-light-gray);
    overflow: hidden;
}

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

.offer-card:hover .offer-image-preview {
    transform: scale(1.05);
}

.offer-image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--salmon-light-gray);
    color: var(--salmon-gray);
    font-size: 3rem;
}

.offer-content {
    padding: 1.5rem;
}

.offer-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--salmon-dark);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.offer-description {
    color: var(--salmon-gray);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.offer-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    justify-content: center;
    min-height: 44px;
}

/* Offer details page buttons - white background, red outline, red text */
.content-section .btn:not(.floating-btn) {
    background: white;
    color: var(--salmon-primary);
    border: 2px solid var(--salmon-primary);
}

.content-section .btn:not(.floating-btn):hover {
    background: var(--salmon-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(240, 90, 90, 0.3);
}

/* Restore original btn-primary styles for other pages */
.btn-primary {
    background: linear-gradient(135deg, var(--salmon-primary) 0%, var(--salmon-secondary) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--salmon-primary);
    border: 2px solid var(--salmon-primary);
}

.btn-secondary:hover {
    background: var(--salmon-primary);
    color: white;
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--salmon-success) 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

.btn-cta {
    background: linear-gradient(135deg, var(--salmon-primary) 0%, var(--salmon-secondary) 100%);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px -5px rgba(240, 90, 90, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Back button */
.back-button-container {
    margin-bottom: 2rem;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--salmon-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.back-button:hover {
    background: var(--salmon-light-gray);
    border-color: var(--salmon-primary);
    transform: translateX(-2px);
}

.back-button i {
    font-size: 0.75rem;
}

/* Campaign title */
.campaign-title {
    text-align: left;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}

.campaign-title h1 {
    color: var(--salmon-dark);
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 3rem;
}

.content-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--salmon-border);
}

.content-section h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    color: var(--salmon-dark);
    font-size: 1.25rem;
}

.content-section h3 i {
    color: var(--salmon-primary);
    font-size: 1.1rem;
}

/* Promo materials */
.promo-image-wrapper {
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    background: var(--salmon-light-gray);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promo-image-real {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
}

.promo-image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: var(--salmon-light-gray);
    color: var(--salmon-gray);
    font-size: 3rem;
}

.promo-text {
    background: var(--salmon-light-gray);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--salmon-primary);
    padding-bottom: 2.5rem;
}

.promo-text p {
    margin: 0;
    color: var(--salmon-dark);
    line-height: 1.6;
    white-space: pre-wrap;
    font-family: inherit;
}

.affiliate-link-container {
    background: var(--salmon-light-gray);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--salmon-primary);
}

.affiliate-link {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--salmon-border);
    margin-bottom: 1rem;
    word-break: break-all;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    color: var(--salmon-dark);
}

.link-note {
    color: var(--salmon-gray);
    font-size: 0.875rem;
    font-style: italic;
    margin: 0;
}

/* Floating Posted Button */
.floating-posted-button {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    animation: slideUp 0.3s ease;
    background: white;
    padding: 1rem;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1), 0 -2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: none;
    background: linear-gradient(135deg, var(--salmon-primary) 0%, var(--salmon-secondary) 100%);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 160px;
    min-height: 44px;
    justify-content: center;
    text-transform: none;
    letter-spacing: normal;
}

.floating-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(240, 90, 90, 0.3);
}

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

.floating-btn .btn-text {
    white-space: nowrap;
    color: white;
}

/* Hide floating button when modal is open */
.modal.show ~ .floating-posted-button {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Sidebar */
.sidebar {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--salmon-border);
    height: fit-content;
}

.sidebar h3 {
    color: var(--salmon-dark);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.sidebar-info {
    margin-bottom: 1.5rem;
}

.sidebar-info h4 {
    color: var(--salmon-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.sidebar-info p {
    color: var(--salmon-dark);
    margin: 0;
    font-weight: 500;
}

/* Error page styles */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    padding: 2rem;
}

.error-content {
    text-align: center;
    max-width: 500px;
    background: white;
    padding: 3rem 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--salmon-border);
}

.error-icon {
    font-size: 4rem;
    color: var(--salmon-error);
    margin-bottom: 2rem;
    animation: bounce 0.6s ease;
}

.error-content h1 {
    color: var(--salmon-dark);
    margin-bottom: 1rem;
    font-size: 2rem;
    font-weight: 700;
}

.error-content p {
    color: var(--salmon-gray);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Loading and error states */
.loading-state, .error-state {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-spinner {
    border: 4px solid var(--salmon-border);
    border-top: 4px solid var(--salmon-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

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

.loading-state h2 {
    color: var(--salmon-dark);
    margin-bottom: 1rem;
}

.loading-state p {
    color: var(--salmon-gray);
}

.error-state h2 {
    color: var(--salmon-error);
    margin-bottom: 1rem;
}

.error-state p {
    color: var(--salmon-gray);
    margin-bottom: 2rem;
}

.retry-btn {
    background: var(--salmon-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.retry-btn:hover {
    background: var(--salmon-secondary);
}

/* Notifications */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: var(--salmon-success);
}

.notification.error {
    background: var(--salmon-error);
}

.notification.info {
    background: var(--salmon-info);
}

.notification.warning {
    background: var(--salmon-warning);
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px) scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid var(--salmon-border);
}

.modal-header h2 {
    margin: 0;
    color: var(--salmon-dark);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h2 i {
    color: var(--salmon-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--salmon-gray);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--salmon-light-gray);
    color: var(--salmon-dark);
}

.modal-body {
    padding: 2rem;
    text-align: center;
}

.thank-you-icon {
    font-size: 4rem;
    color: var(--salmon-success);
    margin-bottom: 1.5rem;
    animation: bounce 0.6s ease;
}

.modal-body h3 {
    color: var(--salmon-dark);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.modal-body p {
    color: var(--salmon-gray);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.encouragement-text {
    color: var(--salmon-primary) !important;
    font-weight: 600;
    font-style: italic;
}

.modal-footer {
    padding: 1rem 2rem 2rem;
    text-align: center;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 0.5rem; /* tighter spacing from input above */
}

/* Increase vertical padding for modal buttons */
.modal-footer .btn {
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

/* Desktop: buttons side by side */
.modal-footer .btn {
    flex: 0 0 auto;
}

/* Simple Modal Styles */
.simple-modal {
    max-width: 300px;
    width: 90%;
}

.simple-modal-body {
    padding: 2rem;
    text-align: center;
}

.simple-icon {
    font-size: 3rem;
    color: var(--salmon-success);
    margin-bottom: 1rem;
    animation: bounce 0.6s ease;
}

.simple-modal-body h3 {
    color: var(--salmon-dark);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.simple-modal-body p {
    color: var(--salmon-gray);
    margin: 0;
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .main {
        padding: 1rem 0;
    }
    
    .offers-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .content-header h1 {
        font-size: 2rem;
    }
    
    .offer-hero h1 {
        font-size: 2rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .notification {
        right: 1rem;
        left: 1rem;
        transform: translateY(-100%);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .offer-content {
        padding: 1rem;
    }
    
    .content-section {
        padding: 1.5rem;
    }
    
    .sidebar {
        padding: 1.5rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .offer-actions {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-footer {
        padding: 1rem 1.5rem 1.5rem;
        display: block;
        margin-top: 0.5rem;
    }
    .modal-footer .btn {
        display: block;
        width: 100%;
        padding-top: 1rem;
        padding-bottom: 1rem;
        flex: none;
    }
    /* Equal spacing between stacked buttons on mobile */
    .modal-footer .btn + .btn {
        margin-top: 1rem;
    }
    /* Put Cancel below Submit on mobile by source order + grid */
    #posted-list-submit {
        order: 1;
    }
    .modal-footer .btn.btn-secondary {
        order: 2;
    }
    
    .thank-you-icon {
        font-size: 3rem;
    }
    
    .modal-body h3 {
        font-size: 1.25rem;
    }
    
    .simple-modal {
        max-width: 280px;
    }
    
    .simple-modal-body {
        padding: 1.5rem;
    }
    
    .simple-icon {
        font-size: 2.5rem;
    }
    
    .simple-modal-body h3 {
        font-size: 1.25rem;
    }
    
    .floating-posted-button {
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0.75rem;
    }
    
    .floating-btn {
        width: 100%;
        min-width: auto;
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .floating-btn .btn-text {
        flex: 1;
        text-align: center;
    }
}
