/* 
 * USB Cables Customizer - Main Stylesheet
 * usbcables.nz
 */

/* Variables */
:root {
  --primary-color: #1E88E5;      /* Bright blue */
  --secondary-color: #FF9800;    /* Vibrant orange */
  --accent-color: #9C27B0;       /* Soft purple */
  --light-bg: #f8f9fa;
  --dark-bg: #212529;
  --text-color: #333;
  --light-text: #f8f9fa;
  --border-radius: 4px;
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
  --item-width: 100%;           /* Standard width for items */
  --container-padding: 0.75rem;
  --component-gap: 0.75rem;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--light-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'%3E%3Cg opacity='0.001'%3E%3Crect x='100' y='150' width='60' height='60' rx='6' ry='6' fill='%231E88E5' /%3E%3Crect x='110' y='160' width='40' height='40' rx='4' ry='4' fill='%230D47A1' /%3E%3Cpath d='M160,180 L240,180 C240,180 230,160 220,160 L180,160 C170,160 160,180 160,180 Z' fill='%23FF9800' /%3E%3Cpath d='M160,180 L240,180 C240,180 230,200 220,200 L180,200 C170,200 160,180 160,180 Z' fill='%23F57C00' /%3E%3Crect x='240' y='150' width='60' height='60' rx='6' ry='6' fill='%239C27B0' /%3E%3Crect x='250' y='160' width='40' height='40' rx='4' ry='4' fill='%236A1B9A' /%3E%3C/g%3E%3C/svg%3E");
  background-size: 400px 400px;
  color: var(--text-color);
  line-height: 1.5;
  min-height: 100dvh;
  position: relative;
}

/* App Container */
.app-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background-color: rgba(255, 255, 255, 0.8);
  padding: 0.75rem 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (min-width: 480px) {
  .app-header {
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
  }
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
}

@media (min-width: 480px) {
  .logo-container {
    margin-bottom: 0;
  }
}

.logo {
  height: 30px;
  width: auto;
  max-width: 100%;
}

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

.app-header h1 {
  font-size: 2.25rem !important;
  margin: 0;
}

.app-header p {
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: var(--container-padding);
  overflow-y: auto;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* Navigation */
.main-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.95);
  display: flex;
  justify-content: space-around;
  padding: 0.5rem;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.main-nav button {
  background: none;
  border: none;
  padding: 0.5rem 0.25rem;
  font-size: 0.85rem;
  color: var(--text-color);
  flex: 1;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--border-radius);
}

.main-nav button.active {
  color: var(--primary-color);
  font-weight: bold;
  background-color: rgba(30, 136, 229, 0.1);
}

.main-nav button:hover {
  background-color: rgba(30, 136, 229, 0.05);
}

/* Cable Customizer */
.cable-customizer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--component-gap);
  width: var(--item-width);
}

.cable-visualizer {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--item-width);
  margin: 0 auto;
}

/* Termination Selectors */
.termination-selector {
  width: var(--item-width);
  padding: 0.5rem;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 0;
  transition: var(--transition);
}

.termination-selector.top {
  border-left: 4px solid var(--primary-color);
}

.termination-selector.bottom {
  border-left: 4px solid var(--secondary-color);
}

.termination-selector label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: bold;
  color: var(--primary-color);
  font-size: 0.9rem;
}

.termination-selector select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  background-color: white;
  cursor: pointer;
}

.termination-visual {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-top: 0.25rem;
  gap: 0.5rem;
}

.termination-visual img,
.termination-visual .svg-icon {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  flex-shrink: 0;
}

.svg-icon {
  display: inline-block;
}

.termination-description {
  font-size: 0.75rem;
  color: #666;
  flex-grow: 1;
}

/* Cable Body */
.cable-body {
  position: relative;
  width: 100%;
  height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cable-line {
  width: 1.5rem;
  height: 100%;
  background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
  border-radius: 4px;
  position: relative;
}

/* Length Selector */
.length-selector {
  background-color: white;
  border-radius: var(--border-radius);
  padding: 0.5rem;
  box-shadow: var(--box-shadow);
  width: var(--item-width);
  position: absolute;
  z-index: 10;
  border-left: 4px solid var(--accent-color);
}

.length-selector label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: bold;
  color: var(--accent-color);
  font-size: 0.9rem;
}

.length-selector select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  background-color: white;
  cursor: pointer;
}

/* Cable Summary */
.cable-summary {
  background-color: white;
  border-radius: var(--border-radius);
  padding: 0.75rem;
  box-shadow: var(--box-shadow);
  width: var(--item-width);
  text-align: center;
  border-left: 4px solid var(--primary-color);
}

.cable-summary h3 {
  color: var(--primary-color);
  margin-bottom: 0.25rem;
  font-size: 1.1rem;
}

.cable-summary .price {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--accent-color);
  margin: 0.25rem 0 0.5rem;
}

.add-to-cart-btn {
  background-color: var(--secondary-color);
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition);
  width: var(--item-width);
}

.add-to-cart-btn:hover:not(:disabled) {
  background-color: #e68a00;
  transform: translateY(-2px);
}

.add-to-cart-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.7;
}

.add-to-cart-btn.added {
  animation: pulse 0.3s ease;
  background-color: #4CAF50; /* Green color for success */
}

/* Cart View */
.cart-container {
  padding: 0;
  width: var(--item-width);
}

.cart-container h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1.25rem;
}

.empty-cart {
  text-align: center;
  padding: 1rem;
}

.shop-now-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-size: 1rem;
  cursor: pointer;
  margin-top: 1rem;
  transition: var(--transition);
}

.shop-now-btn:hover {
  background-color: #1976d2;
}

.cart-item {
  background-color: white;
  border-radius: var(--border-radius);
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-left: 4px solid var(--primary-color);
  width: var(--item-width);
}

.item-details h3 {
  font-size: 0.95rem;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.item-details p {
  margin-bottom: 0.15rem;
  color: #666;
  font-size: 0.85rem;
}

.item-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.25rem;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.quantity-control button {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background-color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}

.quantity-control button:hover:not(:disabled) {
  background-color: #f0f0f0;
}

.quantity-control button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.remove-btn {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--border-radius);
  margin-left: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.8rem;
}

.remove-btn:hover {
  background-color: #d32f2f;
}

.cart-summary {
  margin-top: 1.25rem;
  text-align: center;
  background-color: white;
  border-radius: var(--border-radius);
  padding: 0.75rem;
  box-shadow: var(--box-shadow);
  border-left: 4px solid var(--accent-color);
}

.cart-total {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 0.75rem;
}

.checkout-btn {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition);
  width: var(--item-width);
}

.checkout-btn:hover {
  background-color: #7b1fa2;
  transform: translateY(-2px);
}

/* FAQ View */
.faq-container {
  padding: 0;
  width: var(--item-width);
}

.faq-container h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1.25rem;
}

.faq-item {
  margin-bottom: 0.75rem;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  border-left: 4px solid var(--accent-color);
}

.faq-item h3 {
  background-color: white;
  padding: 0.75rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  font-size: 1rem;
}

.faq-item h3.active {
  background-color: var(--primary-color);
  color: white;
}

.toggle-icon {
  font-size: 1.2rem;
  font-weight: bold;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background-color: white;
}

.faq-answer.open {
  max-height: 500px;
  padding: 0.75rem;
  font-size: 0.9rem;
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.add-to-cart-btn:active {
  animation: pulse 0.3s ease;
}

/* Responsive Styles */
@media (min-width: 480px) {
  :root {
    --item-width: 100%;
    --container-padding: 1rem;
    --component-gap: 0.75rem;
  }
  
  .main-content {
    max-width: 420px;
    padding: var(--container-padding);
  }
  
  .cable-body {
    height: 100px;
  }
  
  .cart-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .item-details {
    flex: 1;
  }
}

@media (min-width: 768px) {
  :root {
    --item-width: 100%;
    --container-padding: 1.25rem;
    --component-gap: 1rem;
  }
  
  .app-header {
    padding: 1rem;
  }
  
  .app-header h1 {
    font-size: 2.5rem;
  }
  
  .main-content {
    max-width: 460px;
  }
  
  .termination-selector select,
  .length-selector select {
    padding: 0.5rem;
  }
  
  .checkout-btn {
    padding: 0.75rem 1.5rem;
  }
}
