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

:root {
    --primary: #2ad6ff;
    --primary-dark: #1a9fbf;
    --secondary: #7fffd4;
    --accent: #00ffff;
    --bg-dark: #0a0a0a;
    --bg-card: rgba(20, 20, 20, 0.9);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #2ad6ff33;
    --success: #00d966;
    --warning: #ffb700;
    --error: #ff4444;
    --glow: 0 0 20px #2ad6ff55;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: radial-gradient(circle at top, #0a0a0a 40%, #000 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
      color: #2ad6ff;
      font-weight: 600;
      text-decoration: underline;
      transition: color 0.2s ease-in-out;
}

a:hover {
      color: #00ffff;
}

header {
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.95) 0%, rgba(10, 10, 10, 0.95) 100%);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--glow);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
}

.logo i {
    font-size: 2rem;
    color: var(--accent);
}

nav {
    display: flex;
    gap: 2rem;
    list-style: none;
}

nav button {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

nav button:hover,
nav button.active {
    color: var(--primary);
    background: var(--border-color);
}

.user-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-info span {
    color: var(--primary);
    font-weight: bold;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.hero {
    background: linear-gradient(135deg, rgba(42, 214, 255, 0.1) 0%, rgba(127, 255, 212, 0.05) 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: var(--glow);
}

.hero h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(42, 214, 255, 0.5);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.balance-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--glow);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.balance-item {
    text-align: center;
}

.balance-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.balance-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary);
    text-shadow: 0 0 10px rgba(127, 255, 212, 0.5);
}

.balance-value i {
    margin-right: 0.5rem;
}

.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
    overflow-x: auto;
}

.tab-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

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

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    background: rgba(20, 20, 20, 0.8);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(42, 214, 255, 0.3);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #2ad6ff 0%, #1a9fbf 100%);
    color: #000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(42, 214, 255, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #7fffd4 0%, #5fd9a8 100%);
    color: #000;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(127, 255, 212, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    color: #fff;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 68, 68, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #00d966 0%, #00a84d 100%);
    color: #000;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 217, 102, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ffb700 0%, #cc9200 100%);
    color: #000;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 183, 0, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-small {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

.table-container {
    overflow-x: auto;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--glow);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

thead {
    background: rgba(42, 214, 255, 0.1);
    border-bottom: 2px solid var(--border-color);
}

th {
    padding: 1rem;
    text-align: left;
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tbody tr:hover {
    background: rgba(42, 214, 255, 0.05);
}

tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-open {
    background: rgba(0, 217, 102, 0.2);
    color: var(--success);
}

.status-completed {
    background: rgba(42, 214, 255, 0.2);
    color: var(--primary);
}

.status-cancelled {
    background: rgba(255, 68, 68, 0.2);
    color: var(--error);
}

.status-pending {
    background: rgba(255, 183, 0, 0.2);
    color: var(--warning);
}

.status-confirmed {
    background: rgba(0, 217, 102, 0.2);
    color: var(--success);
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: rgba(0, 217, 102, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.alert-danger {
    background: rgba(255, 68, 68, 0.1);
    color: var(--error);
    border-color: var(--error);
}

.alert-warning {
    background: rgba(255, 183, 0, 0.1);
    color: var(--warning);
    border-color: var(--warning);
}

.alert-info {
    background: rgba(42, 214, 255, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.modal-header h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--primary);
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    border-top: 2px solid var(--border-color);
    padding-top: 1rem;
}

.modal-footer button {
    flex: 1;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

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

.price-highlight {
    color: var(--secondary);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(127, 255, 212, 0.5);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--error);
}

.text-warning {
    color: var(--warning);
}

.text-info {
    color: var(--primary);
}

.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }
.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.hidden {
    display: none !important;
}

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

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-secondary);
}

.small {
    font-size: 0.85rem;
}

.large {
    font-size: 1.2rem;
}

.bold {
    font-weight: bold;
}

.italic {
    font-style: italic;
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }

    nav {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .balance-card {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer button {
        flex: auto;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.75rem;
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--glow);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    color: var(--primary);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(42, 214, 255, 0.5);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button:hover,
.pagination button.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--border-color);
}

.modal-warning {
    background: rgba(255, 183, 0, 0.1);
    border: 2px solid var(--warning);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: var(--warning);
    display: none;
}

.text-no-wrap {
    white-space: nowrap;
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--primary);
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Hidden/Visible Classes */
#exchangeTabBtn.hidden,
#myTradesTabBtn.hidden,
#adminTabBtn.hidden,
#logoutBtn.hidden {
    display: none;
}

#exchangeTabBtn:not(.hidden),
#myTradesTabBtn:not(.hidden),
#adminTabBtn:not(.hidden),
#logoutBtn:not(.hidden) {
    display: inline-block;
}

/* Card Styles */
.card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--glow);
    margin-bottom: 2rem;
}

.card-title {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* Auth Forms Grid */
.auth-forms-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Full Width Button */
.full-width {
    width: 100%;
}

/* Readonly Input */
.readonly-input {
    background: rgba(0, 0, 0, 0.3);
    cursor: not-allowed;
}

/* Logout Button */
.logout-btn {
    margin-left: 1rem;
}

/* Price Display */
.price-display {
    background: rgba(42, 214, 255, 0.1);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.price-display-label {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.price-display-value {
    color: var(--secondary);
    font-size: 1.5rem;
    font-weight: bold;
}

/* Modal Info Box */
.modal-info-box {
    background: rgba(42, 214, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.modal-info-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.modal-info-value {
    color: var(--secondary);
    font-weight: bold;
    font-size: 1.1rem;
}

/* Modal Info Grid */
.modal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Modal Message */
.modal-message {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Order Book Layout */
.order-book-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.order-book-section {
    min-height: 400px;
}

@media (max-width: 768px) {
    .auth-forms-grid {
        grid-template-columns: 1fr;
    }

    .modal-info-grid {
        grid-template-columns: 1fr;
    }

    .order-book-container {
        grid-template-columns: 1fr;
    }
}
