/* Reset some default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

html, body {
    height: 100%; /* Make sure the body and html can fill the full height */
}
  
body {
    font-family: sans-serif;
    background-color: #121212;
    color: #eee;
    line-height: 1.6;
    min-height: 100vh; /* Ensure body takes at least full viewport height */
    display: grid;
    grid-template-rows: auto 1fr auto; /* header, main content, footer */
    grid-template-areas: 
        "header"
        "main" 
        "footer";
}

/* Top Navigation Bar */
.top-bar {
    background-color: #1a1a1a;
    padding: 12.5px 20px;
    grid-area: header;
  }
  
/* Style for the active link */
.top-bar nav ul li a.active-link {
  color: #4bc0c0; /* Teal color for active link */
  font-weight: bold;
}

  .top-bar nav ul {
    list-style: none;
    display: flex;
    justify-content: flex-start;
  }
  
  .top-bar nav ul li {
    margin-right: 20px;
  }
  
  .top-bar nav ul li a {
    text-decoration: none;
    color: #eee;
    font-weight: bold;
  }
  
  .top-bar nav ul li a:hover {
    color: #4bc0c0;
  }

.header {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #2a2a2a, #1e1e2e);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    border-bottom: 3px solid #444;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stats-display {
    font-size: 12px;
    color: #aaa;
}

.spam-toggle {
    background: linear-gradient(135deg, #ff4444, #cc3333);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
    position: relative;
    overflow: hidden;
}

.spam-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.spam-toggle:hover::before {
    left: 100%;
}

.spam-toggle.active {
    background: linear-gradient(135deg, #44ff44, #33cc33);
    box-shadow: 0 4px 15px rgba(68, 255, 68, 0.3);
}

.spam-toggle:hover {
    transform: scale(1.05);
}

.settings-btn {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.settings-btn:hover {
    background: linear-gradient(135deg, #357abd, #2968a3);
    transform: translateY(-2px);
}

.main-content {
    margin-top: 140px;
    padding: 20px;
}

.keyboard-container {
    background: linear-gradient(135deg, #2a2a2a, #1e1e2e);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border: 1px solid #333;
    backdrop-filter: blur(10px);
    overflow-x: auto;
}

.keyboard {
    display: grid;
    gap: 5px;
    justify-content: center;
    min-width: 1300px;
    max-width: 1300px;
    margin: 0 auto;
}

.keyboard-100 { grid-template-columns: repeat(96, 1fr); }

.key-spacer {
    visibility: hidden;
    pointer-events: none;
}

.key {
    background: linear-gradient(145deg, #3a3a3a, #2d2d2d);
    border: 2px solid #555;
    border-radius: 8px;
    color: #fff; /* This makes the text white */
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    /* This transition makes the color changes smooth! */
    transition: background 0.4s ease, border-color 0.4s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 40px;
    text-align: center;
    padding: 2px;
    overflow: hidden;
}

.key-num-enter-tall, .key-num-plus-tall { 
    grid-row: span 2;
    min-height: 85px;
}

.key::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.key:hover::before {
    opacity: 1;
}

.key:hover {
    border-color: #777;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.key.pressed {
    animation: keyPress 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), 
              pulse 0.2s ease-out;
}

.key-label {
    font-size: 9px;
    margin-bottom: 2px;
    z-index: 1;
    text-shadow: none; /* Removed the outline/shadow */
}

.key-percent {
    font-size: 7px;
    opacity: 0.9;
    z-index: 1;
    text-shadow: none; /* Removed the outline/shadow */
}

.stats-container {
    background: linear-gradient(135deg, #2a2a2a, #1e1e2e);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border: 1px solid #333;
    backdrop-filter: blur(10px);
}

.stats-header {
    position: sticky;
    top: 140px;
    background: linear-gradient(135deg, #2a2a2a, #1e1e2e);
    padding: 15px 0;
    border-bottom: 2px solid #444;
    margin-bottom: 15px;
    z-index: 100;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.sort-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

.sort-btn {
    background: linear-gradient(135deg, #4a4a4a, #363636);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sort-btn.active {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.sort-btn:hover {
    transform: translateY(-2px);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(42, 42, 42, 0.5);
    border-radius: 12px;
    overflow: hidden;
}

.stats-table th,
.stats-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #444;
}

.stats-table th {
    background: linear-gradient(135deg, #3a3a3a, #2d2d2d);
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.stats-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.01);
    transition: all 0.2s;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #2a2a2a, #1e1e2e);
    padding: 30px;
    border-radius: 20px;
    min-width: 400px;
    max-width: 80vw;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #444;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.modal h2 {
    margin-bottom: 20px;
    color: #4a90e2;
    text-align: center;
}

.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.layout-option {
    background: linear-gradient(135deg, #3a3a3a, #2d2d2d);
    color: white;
    border: 2px solid #444;
    padding: 20px;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.layout-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74, 144, 226, 0.2), transparent);
    transition: left 0.5s;
}

.layout-option:hover::before {
    left: 100%;
}

.layout-option:hover {
    border-color: #4a90e2;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.layout-option.active {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border-color: #4a90e2;
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.4);
}

.layout-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 8px;
}

.layout-desc {
    font-size: 12px;
    opacity: 0.8;
}

.close-modal {
    background: linear-gradient(135deg, #ff4444, #cc3333);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    width: 100%;
    font-size: 14px;
    transition: all 0.3s;
}

.close-modal:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
}

.legend {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    font-size: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #444;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #555;
}

.notification {
    position: fixed;
    top: 140px;
    right: 20px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    z-index: 1500;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.progress-bar {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    margin: 5px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff00, #ffff00, #ff8000, #ff0000);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.info-panel {
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(5px);
}

.warning-text {
    color: #ff6b6b;
    font-size: 12px;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
}

/* Animations */
@keyframes keyPress {
    0% { transform: scale(1) translateY(0); }
    50% { transform: scale(0.95) translateY(2px); background: #fff; color: #000; }
    100% { transform: scale(1) translateY(0); }
}

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

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

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #357abd, #2968a3);
}

footer {
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
    color: #888;
}

footer a {
    color: #4bc0c0;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}
