:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --secondary-color: #00c6ff;
    --secondary-dark: #0093cc;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 8px;
    --box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    color: #333;
}

.app-container {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    width: 100%;
    max-width: 1200px;
    animation: fadeIn 0.8s ease-out;
}

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

.app-header {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    padding: 25px 20px;
    text-align: center;
    color: white;
}

.app-header h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

.app-body {
    padding: 30px;
}

.app-footer {
    padding: 20px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    font-size: 14px;
    color: #777;
    text-align: center;
}

.action-button {
    padding: 10px 20px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    cursor: pointer;
    margin-right: 10px;
    margin-bottom: 10px;
}

.action-button i {
    margin-right: 8px;
}

.primary-button {
    background-color: var(--primary-color);
}

.primary-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.danger-button {
    background-color: #dc3545;
}

.danger-button:hover {
    background-color: #bd2130;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.success-button {
    background-color: #28a745;
}

.success-button:hover {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.warning-button {
    background-color: #ffc107;
    color: #212529;
}

.warning-button:hover {
    background-color: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    transition: var(--transition);
    margin-bottom: 15px;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.hex-table {
    font-family: monospace;
    white-space: pre-wrap;
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.hex-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 4px;
    text-align: center;
    font-size: 14px;
}

.hex-table td {
    padding: 6px 4px;
    text-align: center;
    border: 1px solid #eee;
    font-size: 14px;
}

.hex-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.hex-table tr:hover {
    background-color: #f1f1f1;
}

.hex-table .offset {
    color: #666;
    font-weight: 600;
}

.hex-table .ascii {
    border-left: 2px solid #ddd;
    font-weight: 500;
}

.marked {
    background-color: #ffcccb !important;
}

.highlight {
    background-color: orange !important;
}

#contextMenu {
    position: absolute;
    display: none;
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid #eee;
    box-shadow: var(--box-shadow);
    z-index: 1000;
    overflow: hidden;
}

#contextMenu button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    transition: var(--transition);
}

#contextMenu button:hover {
    background-color: #f1f1f1;
    color: var(--primary-color);
}

.selection-info {
    margin-top: 20px;
    font-weight: 500;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.file-info {
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.search-section {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.search-section .form-control {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.search-results-count {
    font-weight: 500;
    color: var(--primary-color);
    margin: 0 10px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-family: 'Poppins', sans-serif;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

.modal-title {
    margin-top: 0;
    color: var(--primary-color);
}

.modal-body {
    margin: 20px 0;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    text-align: right;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.byte-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.byte-info-item {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: var(--border-radius);
    flex: 1;
    min-width: 200px;
}

.byte-info-item h4 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 16px;
    margin-bottom: 5px;
}

@media (max-width: 768px) {
    .app-container {
        max-width: 100%;
    }

    .app-body {
        padding: 20px 15px;
    }

    .action-button {
        width: 100%;
        margin-right: 0;
    }

    .search-section {
        flex-direction: column;
        align-items: stretch;
    }

    .search-section .form-control {
        width: 100%;
    }
}