/*
  © 2025 Milos Saric. All rights reserved.
  This CSS file is protected by copyright law and international treaties.
  Unauthorized reproduction or redistribution is strictly prohibited.
  Contact: milossaric@outlook.com
*/

/* Modern Calculator Styles */
:root {
    --primary-color: #000;
    --secondary-color: #333;
    --accent-color: #666;
    --light-bg: #f7f9fc;
    --border-color: #e0e0e0;
    --text-color: #333;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --button-primary: #000;
    --button-secondary: transparent;
}

body {
    background-color: #fff;
}

.hero {
    background-color: var(--secondary-color);
    background-image: linear-gradient(to right, #000, #333);
    color: white;
    padding: 80px 0;
    margin-bottom: 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.hero-subtitle {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.9;
}

/* Calculator Section */
.calculator-section {
    padding: 60px 0;
    background-color: #fff;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 40px;
    color: var(--secondary-color);
    text-align: center;
    font-weight: 600;
}

.calculator-container {
    display: flex;
    flex-direction: row;
    max-width: 100%;
    margin: 0 auto;
}

.calculator-form {
    width: 100%;
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    margin-bottom: 20px;
    font-size: 1.3rem;
    color: var(--secondary-color);
    font-weight: 600;
    position: relative;
    padding-bottom: 10px;
}

.form-section h3:after {
    content: '';
    position: absolute;
    width: 40px;
    height: 3px;
    background-color: var(--primary-color);
    bottom: 0;
    left: 0;
}

.material-section {
    background-color: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-group {
    margin-bottom: 18px;
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
    outline: none;
}

.connection-entries {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.results-section {
    width: 100%;
}

/* Tabs for results */
.results-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active:after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.matrix-container {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    overflow-x: auto;
}

.matrix-title {
    margin-bottom: 25px;
    font-size: 1.3rem;
    color: var(--secondary-color);
    font-weight: 600;
    display: flex;
    align-items: center;
}

.matrix-title:before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 24px;
    background-color: var(--primary-color);
    margin-right: 15px;
    border-radius: 3px;
}

.matrix-table {
    border-collapse: collapse;
    width: 100%;
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    font-size: 0.9rem;
}

.matrix-table td {
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    text-align: center;
}

.matrix-table th {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 12px 14px;
    text-align: center;
    font-weight: 600;
    border: 1px solid var(--border-color);
    color: var(--secondary-color);
}

.matrix-table tr:nth-child(even) {
    background-color: var(--light-bg);
}

/* Calculate Button */
#calculate-btn {
    background-color: var(--button-primary);
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: block;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#calculate-btn:hover {
    background-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

#calculate-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .calculator-container {
        flex-direction: column;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .connection-entries {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .matrix-table {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .section-title {
        font-size: 1.7rem;
    }
    
    .connection-entries {
        grid-template-columns: 1fr;
    }
    
    .tab-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Match button style from first index.html */
.button-primary {
    background-color: #000;
    color: #fff;
}

.button-secondary {
    background-color: transparent;
    color: #000;
    border: 1px solid #000;
}

.button {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

/* Glassy Back to Top Button */
.button-glassy {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #2d3748;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 40, 0.08);
    transition: all 0.25s ease;
}

.button-glassy:hover {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 6px 16px rgba(0, 0, 40, 0.15);
    transform: translateY(-2px);
}

/* Placement for floating */
.floating-top-btn {
    position: fixed;
    bottom: 40px;
    right: 30px;
    z-index: 100;
    display: none;
}

/* Additional styles for dynamic network configuration */

/* Bus Names Container */
.bus-names-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

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

.input-group label {
    min-width: 80px;
    font-weight: 500;
}

.input-group input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 15px;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
    outline: none;
}

/* Connection Rows */
.connections-list {
    margin-bottom: 20px;
}

.connection-row {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: 8px;
}

.connection-row label {
    font-weight: 500;
    font-size: 14px;
}

.connection-select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 15px;
    background-color: white;
}

.distance-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 15px;
}

.remove-connection-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

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

/* Button Styles */
.button-secondary {
    background-color: transparent;
    color: #000;
    border: 1px solid #000;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.button-secondary:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

#create-network-btn {
    margin-top: 10px;
    margin-left: 10px;
}

#add-connection-btn {
    margin-top: 10px;
    display: block;
}

.calculation-container {
    margin-top: 30px;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .connection-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(3, auto) auto;
        gap: 10px 15px;
    }
    
    .connection-row label {
        align-self: end;
    }
    
    .connection-row select,
    .connection-row input {
        grid-column: span 1;
    }
    
    .remove-connection-btn {
        grid-column: span 2;
        justify-self: end;
        margin-top: 10px;
    }
}

@media (max-width: 576px) {
    .bus-names-container {
        grid-template-columns: 1fr;
    }
    
    .connection-row {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(6, auto) auto;
    }
    
    .remove-connection-btn {
        grid-column: 1;
        justify-self: start;
    }
}

.network-graph-container {
    width: 100%;
    min-height: 500px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
    background-color: #fff;
    overflow: hidden;
}

.network-graph {
    display: block;
    margin: 0 auto;
}

.bus-node {
    cursor: move;
}

.link-label {
    pointer-events: none;
    user-select: none;
}

/**
 * Custom styles for the updated Power Grid Matrix Calculator
 */

/* Bus Selector Section */
.bus-selector-section {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.bus-selector-section .form-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bus-selector-section #bus-count {
    width: 80px;
    text-align: center;
}

.instruction-text {
    font-style: italic;
    color: #6c757d;
    margin: 0 0 15px;
}

/* Updated Tab Buttons Styling */
.results-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.results-tabs .tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    background-color: transparent;
    border-color: transparent;
}

.results-tabs .tab-btn:hover {
    color: var(--primary-color);
    background-color: transparent;
}

.results-tabs .tab-btn.active {
    color: var(--primary-color);
    background-color: transparent;
    border-color: transparent;
}

.results-tabs .tab-btn.active:after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
}

/* Matrix Container Styling */
.matrix-container {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    overflow-x: auto;
}

/* Matrix Table Improvements to match site style */
.matrix-table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 15px;
    font-family: 'SF Pro Display', sans-serif;
    font-size: 14px;
}

.matrix-table th,
.matrix-table td {
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    text-align: center;
}

.matrix-table th {
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 500;
}

.matrix-table tr:nth-child(even) {
    background-color: var(--light-bg);
}

.matrix-table tr:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Graph Display Styling to match site theme */
.graph-display {
    width: 100%;
    min-height: 500px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: #fff;
    overflow: hidden;
    margin-top: 20px;
    box-shadow: var(--shadow);
}

.graph-display svg {
    display: block;
    margin: 0 auto;
}

.graph-display circle {
    cursor: pointer;
    transition: r 0.2s, fill 0.2s;
}

.graph-display circle:hover {
    r: 12;
    fill: var(--primary-color);
}

.graph-display line {
    cursor: pointer;
    transition: stroke-width 0.2s;
}

.graph-display line:hover {
    stroke-width: 3;
}

.graph-display text {
    font-family: 'SF Pro Display', sans-serif;
    font-size: 12px;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .results-tabs .tab-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .graph-display {
        min-height: 400px;
    }
    
    .graph-display text {
        font-size: 10px;
    }
}

@media (max-width: 576px) {
    .results-tabs {
        flex-wrap: wrap;
    }
    
    .results-tabs .tab-btn {
        flex: 1;
        min-width: 100px;
        text-align: center;
    }
}

/* Add these styles to your styles.css file */

/* Update button to match Calculate button styling */
#update-buses-btn {
    background-color: var(--button-primary);
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#update-buses-btn:hover {
    background-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

#update-buses-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Style for the slack bus dropdown */
#slack-bus {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    background-color: #f9f9f9;
    color: #333;
    outline: none;
    transition: border-color 0.3s ease;
  }
  
  #slack-bus:focus {
    border-color: #1e88e5;
    background-color: #fff;
  }

  /* Updated Header Style - White Background with Black Text */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95); /* White semi-transparent background */
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1); /* Subtle bottom border */
  }
  
  .logo a {
    color: var(--text-primary); /* Black text for logo */
    text-decoration: none;
    font-weight: 500;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
    transition: opacity 0.2s ease;
  }
  
  .nav-menu li a {
    color: rgba(0, 0, 0, 0.8); /* Dark text for navigation items */
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    padding: 6px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
  }
  
  .nav-menu li a:hover {
    color: var(--text-primary); /* Black text on hover */
    background-color: rgba(0, 0, 0, 0.05); /* Very light gray background on hover */
  }
  
  /* Active page indicator */
  .nav-menu li a.active {
    color: var(--text-primary); /* Black text for active page */
    font-weight: 500;
  }
  
  
  /* Update for "Remembering Dad" link in white header */
  .nav-menu li:last-child a {
    color: var(--text-primary);
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
  }
  
  .nav-menu li:last-child a:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--text-primary);
    transition: width 0.3s ease;
  }

    /* Responsive design for mobile devices */
    @media (max-width: 768px) {
        .nav-menu {
          position: fixed;
          top: var(--header-height);
          left: 0;
          width: 100%;
          background-color: rgba(0, 0, 0, 0.95);
          flex-direction: column;
          align-items: center;
          gap: 0;
          max-height: 0;
          overflow: hidden;
          transition: max-height 0.4s ease;
          z-index: 999;
        }
        
        .nav-menu.active {
          max-height: 300px;
          border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .nav-menu li {
          width: 100%;
          text-align: center;
        }
        
        .nav-menu li a {
          display: block;
          padding: 15px 0;
          font-size: 1rem;
        }
        
        .mobile-menu-toggle {
          display: flex;
        }
        
        /* Animation for hamburger to X */
        .mobile-menu-toggle.active span:nth-child(1) {
          transform: translateY(8px) rotate(45deg);
        }
        
        .mobile-menu-toggle.active span:nth-child(2) {
          transform: rotate(-45deg);
        }
      }
      /* Mobile menu toggle button - Change color to black */
    .mobile-menu-toggle {
        display: none;
        flex-direction: column;
        justify-content: space-between;
        width: 24px;
        height: 18px;
        cursor: pointer;
      }
      
      .mobile-menu-toggle span {
        display: block;
        height: 2px;
        width: 100%;
        background-color: #000; /* Black bars for hamburger icon */
        border-radius: 1px;
        transition: all 0.3s ease;
      }
      
      /* Responsive design for mobile devices */
      @media (max-width: 768px) {
        .nav-menu {
          position: fixed;
          top: var(--header-height);
          left: 0;
          width: 100%;
          background-color: rgba(255, 255, 255, 0.95); /* White background to match header */
          border-bottom: 1px solid rgba(0, 0, 0, 0.1);
          flex-direction: column;
          align-items: center;
          gap: 0;
          max-height: 0;
          overflow: hidden;
          transition: max-height 0.4s ease;
          z-index: 999;
        }
        
        .nav-menu.active {
          max-height: 300px;
        }
        
        .nav-menu li {
          width: 100%;
          text-align: center;
        }
        
        .nav-menu li a {
          display: block;
          padding: 15px 0;
          font-size: 1rem;
          color: #000; /* Black text for menu items */
        }
        
        .mobile-menu-toggle {
          display: flex;
        }
        
        /* Animation for hamburger to X */
        .mobile-menu-toggle.active span:nth-child(1) {
          transform: translateY(8px) rotate(45deg);
        }
        
        .mobile-menu-toggle.active span:nth-child(2) {
          transform: rotate(-45deg);
        }
      }