@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;800&display=swap');

/* ----------------- VARIABLES ----------------- */
:root {
  --color-bg: #14171A;
  --color-text: #B3D4E9;
  --color-highlight: #F49D42;
  --color-secondary: #7FB1C8;
  --color-tertiary: #F2C57C;
  --color-offwhite: #f0f0f0;
  --color-button-secondary: #6AC6F4;
  --color-success: #42F49D;
  --color-warning: #F46B42;
  --color-border: #2A2F35;

  --font-family: 'Poppins', 'Segoe UI', 'Arial', sans-serif;
  --font-size-base: 1.2rem;
  --font-size-h1: 3rem;
  --font-size-h2: 2.5rem;
  --font-size-h3: 2rem;
  --line-height: 1.6;

  --padding-base: 2rem;
  --button-padding-y: 0.6rem;
  --button-padding-x: 1.2rem;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-weight: 400;
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  padding: 0;
  margin: 0;
  cursor: none; /* hide default cursor */
}


/* hide focus outline */
[contenteditable] {
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
[contenteditable]:focus {
  outline: none;
  background-color: rgba(66, 244, 157, 0.02); /* very subtle highlight */
  box-shadow: 0 0 2px rgba(66, 244, 157, 0.25); /* soft glow */

}
td[contenteditable]:empty {
    caret-color: transparent; /* hide caret when empty */
}

td[contenteditable]:not(:empty) {
    caret-color: var(--color-text); /* show caret when typing */
}
/* custom caret for empty cells */
td:focus:empty::after,
td:focus:empty::after {
    content: '|';
    color: var(--color-tertiary);           /* customize color */
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
/* ---------------------- */

/* The custom cursor */
body, a, button, input, textarea, select, label, span, img, td, li, .hamburger, .poster-container, td *, .modal * {
    cursor: none !important;
}

#cursor {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    font-size: 24px;
    z-index: 9999;
    color: #F46B42;
    transform: translate(-30%, -15%);
    transition: transform 0.08s ease, color 0.08s ease;
}
#cursor.hover { color: #FFD700;  }
#cursor.click { color: #FFD700;  }

@media (hover: none) and (pointer: coarse) {
  #cursor {
    display: none !important;
  }
}
/* /Custom cursor */

h1 { color: var(--color-offwhite); font-weight: 800; font-size: var(--font-size-h1); margin-bottom: 0.5rem; }
h2 { color: var(--color-secondary); font-weight: 700; font-size: var(--font-size-h2); margin-bottom: 0.5rem; }
h3 { color: var(--color-tertiary); font-weight: 700; font-size: var(--font-size-h3); margin-bottom: 0.5rem; }

h1#pageTitle {margin-bottom: 1.5rem;}

.highlight { color: var(--color-highlight); font-weight: 800; }
.success { color: var(--color-success); font-weight: 500; }
.warning { color: var(--color-warning); font-weight: 500; }

.button {
  font-weight: 800;
  padding: var(--button-padding-y) var(--button-padding-x);
  margin: 0.25rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.75rem;
}
.button-primary { background-color: #2A2F35; color: #B3D4E9; font-weight: 400; }
.button-secondary { background-color: var(--color-button-secondary); color: var(--color-bg); }
.button-tertiary {
    position: absolute;
    right: 0px;
    top: 2%;
    background: none;
    color: var(--color-text);
    border: 2px solid var(--color-text);;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    font-size: 0.5rem !important;
    font-weight: 800;
    transition: all 0.2s;
      text-shadow: 
    1px 0 currentColor, 
   -1px 0 currentColor, 
    0 1px currentColor, 
    0 -1px currentColor;
}

.button-tertiary:hover {
    background: white;
    color: var(--color-bg);
}

.palette {
  display: flex;
  flex-wrap: wrap;
  margin-top: 2rem;
  gap: 1rem;
}
.swatch {
  width: 140px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border-radius: 5px;
  color: var(--color-bg);
}

.switcher {
    position: absolute;
    top: 20px;
    right: 20px;
}

input {
  width: 300px;
  padding: 8px;
  font-size: 16px;
  margin-bottom: 20px;
  font-family: var(--font-family);
  color: var(--color-text);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

th, td {
  border: 1px solid var(--color-border);
  padding: 8px;
  text-align: left;
  box-sizing: border-box;
  vertical-align: middle;
  color: var(--color-text);
  position: relative;
}
thead {text-transform: uppercase;}

td {color: var(--color-tertiary);}
th, td.ew, td.pj { text-align: center; }
th { background-color: #1A1F27; color: var(--color-offwhite);}
/*tr:hover { background-color: #1F252E; }
tr.has-value:hover { background-color: #1F252E; }*/

td.film img, td.series img {
  width: 50px;
  height: 75px;
  vertical-align: middle;
  margin-right: 8px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

tr.has-value { background-color: #1F252E; }
tr.has-value td { border-left: 2px solid #1A1F27 !important; border-bottom: 2px solid #1A1F27 !important; }

.search-container {
    position: relative;
    display: inline-block; /* shrink to fit input */
    margin-bottom: 10px;
}

/* Smooth fade + collapse for table rows */
#movieTable tbody tr.hiding {
  opacity: 0;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  transition: opacity 0.4s ease, height 0.4s ease, padding 0.4s ease;
   pointer-events: none; /* prevent clicks on hidden rows */
}

#movieInput {
    width: 300px;
    padding-right: 30px; /* space for spinner */
    box-sizing: border-box;
}

.spinner {
    position: absolute;
    right: 10px;  
    top: 18%;
    transform: translateY(-50%);
    display: none; 
    color: whitesmoke;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.spinner.show { display: inline-block; opacity: 1; }
.spinner.hide { opacity: 0; transition: opacity 0.3s ease; }
.spinner.active { display: inline-block; }
.spinner.fa-check { transform: translateY(-4%); }
.spinner.fa-times { transform: translateY(-4%); }

#movieInput, .search-container .button {
    height: 40px;
    line-height: 40px;
    padding: 0 12px;
    box-sizing: border-box;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #2A2F35;
    vertical-align: middle;
}

.search-container .button {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* search suggestions */
.search-container ul,
#suggestions {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-top: -10px;
  border: 2px solid var(--color-tertiary);
  width: 50%;
  position: absolute;
  background: #1F252E;
  max-height: 350px;
  overflow-y: auto;
  z-index: 1000;
}

.search-container li,
#suggestions li {
  cursor: pointer;
  display: flex;            /* image + info side by side */
  align-items: flex-start;  /* align image top with text */
  gap: 10px;
  padding: 8px 10px;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

#suggestions li:last-child {
  border-bottom: none;
  padding-bottom: 20px;
}

.search-container li img,
#suggestions li img {
  width: 50px;
  height: 75px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.search-container li:hover,
#suggestions li:hover {
  background-color: var(--color-bg);
}

#suggestions li .info {
  display: flex;
  flex-direction: column; /* stack title and year vertically */
}

#suggestions li .info .title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-warning);
}

#suggestions li .info .year {
  font-size: 0.85rem;
  color: #999;
  margin-top: 2px;
}

#suggestions:empty {
  display: none;
}
/* end seach suggestions */




td.film, td.series {font-weight: 800;}
td.film span, td.series span {font-weight: 400; font-size: 0.85em;}
td.film, td.series, td.genre {text-transform: capitalize; }
td.genre { font-size: 0.95rem;}
td.comments { font-size: 0.9rem; color: var(--color-tertiary); max-width: 700px;}
#movieTable img:hover { cursor: pointer; }
td.film img, td.series img {
    user-select: none;     
    -webkit-user-drag: none; 
    -webkit-tap-highlight-color: transparent;
}
td.film img:focus, td.series img:focus { outline: none; }

#scrollBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background-color: #333;
  color: white;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: background-color 0.3s, transform 0.2s, opacity 0.3s;
  opacity: 0.9;
  z-index: 2;
}

#scrollBtn:hover {
  background-color: #555;
  transform: scale(1.1);
}

/* ----------------------
   Modal container
------------------------ */
.modal {
  display: block; /* visible by default, controlled by JS */
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.7);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center; /* center modal-content horizontally */
  padding: 20px; /* spacing for small screens */
}

.modal::before {
  content: '';
  display: inline-block;
  height: 100%; /* vertical centering trick */
  vertical-align: middle;
}

.modal-content {
  display: inline-block; /* for vertical-align centering */
  vertical-align: middle;
  background-color: var(--color-bg, #fff);
  text-align: left;
  padding: 2rem;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 90%;
  position: relative;
  overflow-y: auto;
  color: var(--color-tertiary, #333);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  animation: fadeIn 0.3s ease-in-out;
}

#modalPoster {
  float: left;
  margin: 10px 20px 10px 0; 
  width: 150px;
  height: auto;
  border-radius: 6px;
}

h2#modalTitle {
  display: inline-block;
  max-width: calc(100% - 170px);
   word-wrap: break-word;
   overflow-wrap: break-word;
  padding-top: 0;
  margin-top: 0;
  text-transform: capitalize;
}

#modalPlot {color: #F49D42;}
/* Add opening quote */
#modalPlot::before {
  content: "\f10d"; /* Font Awesome quote-left */
  font-family: "Font Awesome 6 Free"; /* adjust if using another version */
  font-weight: 900; /* necessary for solid icons */
  margin-right: 8px;
  color: var(--color-tertiary);
}

/* Add closing quote */
#modalPlot::after {
  content: "\f10e"; /* Font Awesome quote-right */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: 8px;
  color: var(--color-tertiary);
}

/* Fade-in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Close button */
.close {
  position: absolute;
  top: -10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 3.5rem;
  color: var(--color-highlight, #007BFF);
  cursor: pointer;
  z-index: 1001;
}

.close:hover {
  color: var(--color-highlight, #0056b3);
}

/* Headings inside modal */
.modal h2,
.modal-label {
  color: var(--color-text, #333);
  font-weight: 800;
}

/* Images inside modal */
.modal img {
  width: 100%;
  max-width: 300px;
  border-radius: 5px;
  margin-bottom: 15px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Meta info inside modal */
.modal .meta {
  font-size: 0.9em;
  margin-bottom: 8px;
  color: var(--color-secondary);
}

.modal .meta a {
  color: var(--color-tertiary);
  text-decoration: none;
}

.modal .meta a:hover {
  text-decoration: underline;
}

.modal .meta span {
  color: var(--color-tertiary);
}

/* ----------------------
   Responsive modal tweaks
------------------------ */
@media (max-width: 800px) {
  .modal {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10px 0;
    overflow-y: auto;
  }

  .modal-content {
    width: 95%;
    max-width: 400px;
    max-height: 90vh;
    padding: 1rem;
    overflow-y: auto;
    box-sizing: border-box;
  }
  

  h2#modalTitle {
    display: block;
    width: 100%;      /* full width of modal */
    max-width: 100%;  /* remove 100px restriction */
  }

  #modalPoster {
    float: none;
    display: block;
    width: 100%;
    max-width: 100px; /* optional: keeps poster small on mobile */
    height: auto;
    margin: 0 0 20px 0;
  }

  .close {
    position: absolute;
    top: auto;
    bottom: -10px;
    right: 10px;
    left: auto;
    font-size: 3.5rem;
    color: var(--color-highlight, #007BFF);
  }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px);}
  to { opacity: 1; transform: translateY(0);}
}

/* ----------------------
   End Modal
------------------------ */

@media (max-width: 600px) {
  table, thead, tbody, th, td, tr { display: block; }
  th { display: none; }
  td.film::before { content: "MOVIE"; font-weight: bold; display:block; margin-bottom:2px; color: var(--color-secondary);}
  td.series::before { content: "SERIES"; font-weight: bold; display:block; margin-bottom:2px; color: var(--color-secondary);}
  td.genre::before { content: "GENRE"; font-weight: bold; display:block; margin-bottom:2px; color: var(--color-secondary);}
  td.comments::before { content: "COMMENTS"; font-weight: bold; display:block; margin-bottom:2px; color: var(--color-secondary);}
  td.film {font-weight: 800;} 
  td.series {font-weight: 800;}
  td.ew, td.pj { display: inline-flex; align-items: center; width: 50%; box-sizing: border-box; }
  td.ew::before { content: "EW"; font-weight: bold; margin-right:30%; color: var(--color-secondary);}
  td.pj::before { content: "PJ"; font-weight: bold; margin-right:30%; color: var(--color-secondary);}
  .search-container ul, #suggestions { width:88%; }
  .search-container { flex-direction: column; }
  #movieInput, .search-container .button { width: 100%; }  
  #movieInput { margin-bottom: 5px; }
}

/* Fade-out effect for deleted rows */
tr.fade-out {
  opacity: 0;
  height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border: 0 !important;
  transition: opacity 0.4s ease, height 0.4s ease, padding 0.4s ease;
}


/* Shrink the SweetAlert2 icon and inner SVG */
/* Shrink the circle */
.swal-icon-small {
  transform: scale(0.6) !important;      /* final size */
  animation: none !important;            /* disable the pop animation */
}
.swal-custom-border {
    border: 3px solid #F46B42;   /* border thickness & color */
    border-radius: 12px;          /* optional: rounded corners */
    padding: 1em;                 /* optional: extra space inside */
}
.swal2-confirm {
    background-color: #F46B42 !important;
    color: white !important;
    border-radius: 5px;
    border-color: none !important;
    box-shadow: none !important;
}

.swal-cancel-btn {
    background-color: gray !important;
    color: white !important;
    border-radius: 5px;
}

@media (max-width: 1024px) {
  :root {
    --font-size-base: 1.1rem;
    --font-size-h1: 2.5rem;
    --font-size-h2: 2.2rem;
    --font-size-h3: 1.8rem;
    --button-padding-y: 0.5rem;
    --button-padding-x: 1rem;
  }
  .swatch { width: 120px; height: 50px; font-size: 0.9rem; }
}

@media (max-width: 768px) {
  :root {
    --font-size-base: 1rem;
    --font-size-h1: 2rem;
    --font-size-h2: 1.8rem;
    --font-size-h3: 1.6rem;
    --padding-base: 1.5rem;
    --button-padding-y: 0.45rem;
    --button-padding-x: 0.9rem;
  }
  .swatch { width: 100px; height: 45px; font-size: 0.8rem; }
  tr {margin-bottom: 10px;}
  td.comments {border-bottom: #36454F 1px solid;}
}

@media (max-width: 480px) {
  :root {
    --font-size-base: 0.95rem;
    --font-size-h1: 1.8rem;
    --font-size-h2: 1.6rem;
    --font-size-h3: 1.4rem;
    --padding-base: 1rem;
    --button-padding-y: 0.4rem;
    --button-padding-x: 0.8rem;
  }
  .swatch { width: 80px; height: 40px; font-size: 0.75rem; }
  .spinner {top: 28%;}
}

@media (min-width: 601px) {
    thead th {
        position: sticky;
        top: 82px;
        background-color: #1A1F27; 
        z-index: 10;
    }
    td.film {
    display: flex;
    align-items: center;  
    gap: 10px;            
    text-transform: capitalize;
    }
    td.film img {
    width: 50px;
    height: 75px;
    object-fit: cover;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    flex-shrink: 0;       
    }
    td.film span.title {
        font-weight: 700;
        color: var(--color-tertiary);
    }
}
