/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

/* Color Variables */
:root {
    /* Grays */
    --grey-000: #FFFFFF;
    --grey-100: #F9FAFC;
    --grey-200: #F2F4F9;
    --grey-300: #DADCE2;
    --grey-400: #C3C5CC;
    --grey-500: #ABADB5;
    --grey-600: #93959E;
    --grey-700: #717279;
    --grey-800: #4E4F54;
    --grey-900: #2B2C2F;
    --grey-1000: #09090A;
    
    /* Oranges */
    --orange-100: #FFFBE1;
    --orange-200: #FFF3B6;
    --orange-300: #FECD89;
    --orange-400: #FCA85B;
    --orange-500: #FB832E;
    --orange-600: #F95D00;
    --orange-700: #C34800;
    --orange-800: #8C3300;
    --orange-900: #561D00;
    --orange-1000: #1F0800;
    
    /* Additional colors */
    --red: #F90800;
    --green: #71EF22;
    
    /* Text Sizes */
    --title-h1: 5.33rem; /* 96px */
    --title-h2: 3.56rem; /* 64px */
    --title-h3: 2.67rem; /* 48px */
    --title-h4: 1.33rem; /* 24px */
    --text-subtitle: 1.33rem; /* 24px */
    --text-copy: 1rem; /* 18px */
    --text-copy-small: 0.78rem; /* 14px */
}

/* Base Styles */
html {
    font-size: 18px; /* Base for rem calculations */
}

body {
    font-family: 'Space Mono', monospace;
    background-color: #0b0a0a;
    color: var(--grey-000);
    min-height: 100vh;
}

h1, h2, h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
}

.container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

/* Typography Classes */
.title-h1 {
    font-size: var(--title-h1);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.title-h2 {
    font-size: var(--title-h2);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.title-h3 {
    font-size: var(--title-h3);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.title-h4 {
    font-size: var(--title-h4);
    line-height: 1.1;
    letter-spacing: -0.01em;
    font-weight: 400;
    margin: 0;
}

/* Styling for the new moodboard-info section */
.moodboard-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* Button Styles */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    border: none;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: var(--text-copy-small);
    cursor: pointer;
}

.btn-danger {
    background-color: var(--red);
    color: var(--grey-000);
}

.btn-success {
    background-color: var(--green);
    color: var(--grey-1000);
}

.btn-secondary {
    background-color: var(--grey-300);
    color: var(--grey-1000);
}

.button-row {
    display: flex;
    justify-content: space-between;
    margin-top: 60px;
}

.button-row-create {
    justify-content: flex-end; /* Align to the right since there's only one button */
}

.tooltip {
    position: absolute;
    background-color: var(--orange-600);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: var(--text-copy-small);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    top: -48px; /* Position above the button instead of below */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.tooltip:after {
    content: '';
    position: absolute;
    bottom: -5px; /* Changed from top to bottom */
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0; /* Changed from 0 5px 5px to 5px 5px 0 */
    border-style: solid;
    border-color: var(--orange-600) transparent transparent; /* Changed arrow direction */
}

.alt-button:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%);
}

.copied-tooltip {
    opacity: 0;
    visibility: hidden; /* Add visibility to ensure it's fully hidden */
}

.alt-button:hover .copied-tooltip {
    opacity: 0; /* Explicitly keep it hidden on hover */
    visibility: hidden;
}

.alt-button.active .tooltip {
    opacity: 0;
    visibility: hidden;
}

.alt-button.active .copied-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%);
}

.alt-button {
    width: 64px;
    height: 64px;
    border: 4px solid var(--orange-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--title-h4);
    color: var(--grey-000);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.alt-button:hover {
    background-color: var(--orange-600);
}

.alt-button:active {
    background-color: var(--orange-700);
}

/* Home Page Styles */
.home-page {
    padding: 80px 0;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 40px;
}

.moodboard-count {
    color: var(--grey-500);
    font-size: var(--title-h4);
}

.moodboard-count span {
    color: var(--grey-300); /* Lighter grey for the number */
}

.moodboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.moodboard-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.moodboard-card:not(.moodboard-card-empty):hover .card-image {
    border: 4px solid var(--orange-600);
}

.moodboard-card:not(.moodboard-card-empty):hover .title-h4 {
    color: var(--orange-600);
}

.moodboard-card:not(.moodboard-card-empty):hover .card-line {
    background-color: var(--orange-600);
}

.card-image {
    width: 100%;
    overflow: hidden;
    height: 418px; /* Fixed height for all images */
    border: 4px solid transparent; /* Transparent border by default */
    transition: border 0.3s ease;
}

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

.card-image-empty {
    border: 2px dashed var(--orange-600);
    height: 418px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.moodboard-card-empty:hover .card-image-empty {
    background-color: var(--orange-600);
}

.moodboard-card-empty:hover .plus-icon {
    transform: rotate(90deg);
    color: var(--orange-100);
}

/* Reset on hover out */
.moodboard-card-empty .plus-icon {
    transform: rotate(0deg);
}


.moodboard-card-empty .card-title {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.moodboard-card-empty:hover .card-title {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0s;
}

.moodboard-card-empty:hover .title-h4,
.moodboard-card-empty:hover .fa-arrow-right {
    color: var(--orange-600);
}

.moodboard-card-empty .card-line {
    display: none;
    width: 100%;
    height: 1px;
    background-color: var(--grey-800);
    transition: background-color 0.3s ease;
}

.moodboard-card-empty:hover .card-line {
    visibility: visible;
    opacity: 1;
}


/* Add the rotation animation to the plus sign */
.plus-icon {
    font-size: 96px;
    color: var(--orange-600);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    transition: color 0.3s ease, transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block; /* Needed for rotation to work properly */
    transform-origin: center; /* Ensure rotation happens around the center */
}

.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 8px;
    width: 100%;
}

.card-line {
    width: 100%;
    height: 1px;
    background-color: var(--grey-800);
    transition: background-color 0.3s ease;
}

.moodboard-card .fa-arrow-right {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}

.moodboard-card:hover .fa-arrow-right {
    opacity: 1;
    transform: translateX(0);
    color: var(--orange-600);
}

a.moodboard-card {
    text-decoration: none;
    color: inherit;
}

/* Ensure the Add Moodboard card has the proper arrow */
.moodboard-card-empty .card-title {
    visibility: visible;
    opacity: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Override previous styles for arrow on empty card to make it consistent */
.moodboard-card-empty .fa-arrow-right {
    display: inline-block;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
}

.moodboard-card-empty:hover .fa-arrow-right {
    opacity: 1;
    transform: translateX(0);
    color: var(--orange-600);
}

/* Ensure all elements inside the card link maintain proper styling */
a.moodboard-card .title-h4 {
    color: var(--grey-000);
}

a.moodboard-card:hover .title-h4 {
    color: var(--orange-600);
}

/* Remove default link states */
a.moodboard-card:visited, 
a.moodboard-card:active,
a.moodboard-card:focus {
    color: inherit;
    text-decoration: none;
    outline: none;
}

/* New Moodboard Page Styles */
.moodboard-page {
    padding: 60px 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.page-header .title-h1 {
    font-size: var(--title-h2);
}

.back-button {
    font-size: var(--title-h3);
    color: var(--orange-600);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.back-button:hover {
    color: var(--grey-000);
}

.header-actions {
    display: flex;
    gap: 25px;
}

.image-counter {
    color: var(--grey-500);
    font-size: var(--title-h4);
    margin: 0;
}

/* CSS for direct swapping of image cards */
.image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 40px 0;
  }
  
  .image-card {
    flex: 0 0 calc(33.333% - 14px); /* 3 columns with gap consideration */
    position: relative;
    cursor: grab;
    overflow: hidden;
    border: 8px solid transparent;
    transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    max-width: calc(33.333% - 14px);
    /* Set a fixed aspect ratio */
    aspect-ratio: 3/4; /* This creates a standard card size */
    /* Add transition for smoother card movements */
    transition: all 0.2s ease;
  }
  
  /* Responsive adjustments */
  @media (max-width: 1100px) {
    .image-card {
      flex: 0 0 calc(50% - 10px); /* 2 columns on medium screens */
      max-width: calc(50% - 10px);
    }
  }
  
  @media (max-width: 768px) {
    .image-card {
      flex: 0 0 100%; /* 1 column on small screens */
      max-width: 100%;
    }
  }
  
  .image-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; /* This will crop the image to fill the container */
    transition: transform 0.3s ease;
  }
  
  /* Hover effects */
  .image-card:hover {
    border-color: var(--orange-600);
  }
  
  .image-card:hover img {
    transform: scale(1.05);
  }
  
  .image-card .image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(249, 93, 0, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }
  
  .image-card:hover .image-overlay {
    opacity: 1;
    pointer-events: all;
  }

  
  /* Stop transition during drag operations to avoid jerkiness */
  .image-grid.dragging-active .image-card {
    transition: none;
  }
  
  /* Hover override during drag */
  .image-card.dragging:hover .image-overlay,
  .image-card.dragging .image-overlay {
    opacity: 0 !important;
    pointer-events: none !important;
  }
  
  .image-card.dragging:hover img,
  .image-card.dragging img {
    transform: none !important;
  }
  
  /* Force hardware acceleration for smoother animations */
  .image-card {
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

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

.image-grid > * {
    grid-row-end: span 1; /* Reset default span, will be set by JS */
  }

/* Center zoom button */
.zoom-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Position delete button in bottom right */
.delete-btn {
    position: absolute;
    bottom: 0px;
    right: 0px;
    background-color: var(--orange-600) !important;
    border-radius: 0px !important;
}

.image-action-btn {
    width: 50px;
    height: 50px;
    background-color: var(--grey-1000);
    border: none;
    border-radius: 0px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease;
    z-index: 5;
}

.image-action-btn:hover {
    background-color: var(--grey-900);
}

.image-action-btn.delete-btn:hover {
    background-color: var(--red) !important;
}

/* Lightbox / Zoom view */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

/* Delete confirmation modal */
.delete-image-modal .modal-content {
    max-width: 450px;
    text-align: center;
}

.delete-image-modal h3 {
    margin-bottom: 15px;
    font-size: var(--title-h4);
}

.delete-image-modal p {
    margin-bottom: 30px;
    color: var(--grey-800);
}

.notification-banner.image-deleted,
.notification-banner.error-banner {
    background-color: var(--red);
    color: var(--grey-000);
}

.upload-section {
    margin: 40px 0;
}

.upload-box {
    border: 2px dashed var(--orange-600);
    height: 264px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-box:hover {
    border: 2px solid var(--orange-600);
    background-color: rgba(249, 93, 0, 0.1); /* orange-600 at 10% opacity */
}

.upload-box i {
    font-size: 96px;
    color: var(--orange-600);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.upload-text {
    color: var(--orange-200);
    font-size: var(--title-h4);
    transition: color 0.3s ease;
}

.url-upload {
    border: 2px dashed var(--orange-600);
    padding: 25px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.url-upload:hover {
    border: 2px solid var(--orange-600);
    background-color: rgba(249, 93, 0, 0.1); /* orange-600 at 10% opacity */
}

.url-button {
    display: flex;
    align-items: center;
    gap: 24px;
    color: var(--orange-200);
    font-size: var(--title-h4);
    transition: color 0.3s ease;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--grey-100);
    width: 100%;
    max-width: 600px;
    padding: 32px 40px;
    position: relative;
    color: var(--grey-1000);
}

.modal-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.modal-close {
    font-size: 24px;
    color: var(--grey-800);
    cursor: pointer;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 25px;
}




.section-title {
    font-size: var(--text-copy-small);
    color: var(--grey-800);
    margin-bottom: 16px;
}

.cards-empty {
    border: 2px dashed var(--orange-600);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 198px;
    width: 100%;
    cursor: pointer;
}

.input-frame {
    background-color: var(--grey-300);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.moodboard-name {
    font-size: var(--title-h4);
    color: var(--grey-1000);
}

.error-message {
    color: var(--orange-600);
    font-size: var(--text-copy-small);
    margin-top: 8px;
}

.button-row {
    display: flex;
    justify-content: space-between;
    margin-top: 60px;
}

.notification-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 12px 0;
    background-color: var(--red);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    text-align: center;
    font-weight: bold;
}

.notification-banner p {
    margin: 0;
    padding: 0;
}

.notification-banner.active {
    transform: translateY(0);
}

/* Temporary moodboard specific styles */
.moodboard-card.temp-moodboard {
    position: relative;
}

.moodboard-card.temp-moodboard::after {
    content: 'TEMPORARY';
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--orange-600);
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    pointer-events: none;
}



.notification-banner.success-banner {
    background-color: var(--green);
    color: var(--grey-1000);
}

.delete-confirm-modal .modal-content {
    max-width: 500px;
    text-align: center;
}

.delete-confirm-content h3 {
    margin-bottom: 15px;
    font-size: var(--title-h4);
}

.delete-confirm-content p {
    margin-bottom: 30px;
    color: var(--grey-800);
}

.delete-confirm-content .button-row {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}



/* ADD URL STYLES - URL Upload Form Styles */
.url-upload {
    position: relative;
}

.url-input-container {
    display: flex;
    margin-top: 15px;
    flex-direction: column;
}

.url-input-field {
    background: transparent;
    border: 2px solid var(--orange-600);
    padding: 12px 15px;
    color: var(--grey-000);
    font-family: 'Space Mono', monospace;
    font-size: var(--text-copy);
    width: 100%;
    margin-bottom: 10px;
}

.url-input-field::placeholder {
    color: var(--grey-600);
}

.url-input-field:focus {
    outline: none;
    border-color: var(--orange-300);
}

.url-form-button {
    background-color: var(--orange-600);
    color: white;
    border: none;
    padding: 12px 20px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s ease;
    align-self: flex-end;
}

.url-form-button:hover {
    background-color: var(--orange-700);
}

.url-form-message {
    margin-top: 10px;
    font-size: var(--text-copy-small);
    transition: opacity 0.3s ease;
}

.url-form-message.success {
    color: var(--green);
}

.url-form-message.error {
    color: var(--red);
}

.url-form-footnote {
    color: var(--grey-600);
    font-size: var(--text-copy-small);
    margin-top: 8px;
    font-style: italic;
}

/* CSS to add to styles.css */
.bottom-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 30px;
    padding-bottom: 40px;
}

.clear-cache-button {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--grey-400);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-cache-button i {
    font-size: 16px;
}

.clear-cache-button:hover {
    color: var(--orange-600);
}

.clear-cache-button:hover span {
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .bottom-actions {
        margin-top: 20px;
        padding-bottom: 30px;
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }
    
    .title-h1 {
        font-size: var(--title-h2);
    }
    
    .moodboard-grid, 
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    
    .header-actions {
        gap: 15px;
    }
    
    .alt-button {
        width: 50px;
        height: 50px;
    }
    
    .modal-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .button-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .button-row button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .title-h1 {
        font-size: var(--title-h3);
    }
    
    .moodboard-grid, 
    .image-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;
    }
    
    .header-actions {
        align-self: flex-end;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .moodboard-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions {
        margin-top: 15px;
        align-self: flex-end;
    }
    
    .image-counter {
        margin-bottom: 10px;
    }
}

/* For even smaller screens */
@media (max-width: 480px) {
    .moodboard-info {
        width: 100%;
    }
    
    .header-actions {
        align-self: flex-start;
        margin-top: 15px;
    }
}