/* =================== */
/* MODERN STYLES   */
/* =================== */
:root {
	/* Colors */
	--bg-primary: #0d1117;
	--bg-secondary: #161b22;
	--bg-tertiary: #21262d;
	--bg-card: #1c2128;
	--accent-blue: #58a6ff;
	--accent-green: #3fb950;
	--accent-red: #f85149;
	--accent-orange: #ff8c00;
	--accent-purple: #a5a5ff;
	--text-primary: #f0f6fc;
	--text-secondary: #8b949e;
	--text-muted: #6e7681;
	--text-bright: #ffffff;

	/* Gradients */
	--gradient-primary: linear-gradient(135deg, #58a6ff 0%, #a5a5ff 100%);
	--gradient-success: linear-gradient(135deg, #3fb950 0%, #39d0d8 100%);
	--gradient-danger: linear-gradient(135deg, #f85149 0%, #ff8c00 100%);
	--gradient-card: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);

	/* Borders and shadows */
	--border: rgba(240, 246, 252, 0.1);
	--border-bright: rgba(240, 246, 252, 0.2);
	--shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
	--shadow-glow: 0 0 20px rgba(88, 166, 255, 0.3);
	--radius-md: 12px;
	--radius-lg: 16px;
}

/* =================== */
/* BASE STYLES       */
/* =================== */
* {
	box-sizing: border-box;
}

body {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	margin: 0;
	padding: 12px;
	background: var(--bg-primary);
	color: var(--text-secondary);
	min-height: 100vh;
	overflow-x: hidden;

	/* Modern background with gradient */
	background-image:
		radial-gradient(circle at 20% 80%, rgba(88, 166, 255, 0.1) 0%, transparent 50%),
		radial-gradient(circle at 80% 20%, rgba(165, 165, 255, 0.1) 0%, transparent 50%);
	background-attachment: fixed;
}

/* Typography */
h1, h2, h3, h4 {
	color: var(--text-primary);
	margin: 0;
	font-weight: 600;
}

h2 {
	font-size: 20px;
	margin-bottom: 12px;
}

h3 {
	font-size: 16px;
	margin: 8px 0;
	color: var(--text-bright);
}

/* Modern header */
header {
	text-align: center;
	margin-bottom: 16px;
	padding: 20px 0;
	position: relative;
}

header::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 60px;
	height: 2px;
	background: var(--gradient-primary);
	border-radius: 1px;
}

/* Caption under logos */
.partners-text {
	font-size: 14px;
	color: var(--text-secondary);
	margin: 8px 0 0 0;
	text-transform: uppercase;
	letter-spacing: 1px;
	font-weight: 500;
	text-align: center;
}

/* =================== */
/* LOGOS AND CONTAINERS */
/* =================== */
.logos-container {
	display: flex;
	justify-content: center;
	gap: 12px;
	flex-wrap: wrap;
	padding: 10px 0;
	margin-bottom: 8px;
}

.logo-item {
	padding: 6px 8px;
	background: var(--bg-card);
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
}

.logo-img {
	width: 40px;
	height: 20px;
	object-fit: contain;
	filter: brightness(1.2) saturate(1.1);
}


/* Modern grid */
.container {
	display: grid;
	grid-template-columns: 1fr 2fr 1fr;
	grid-template-rows: minmax(500px, 1.2fr) minmax(320px, 0.8fr);
	gap: 12px;
	height: calc(125vh - 120px);
	/* Increase by 25% */
	min-height: calc(100vh - 80px);
	/* Minimum height for small screens */
	max-width: 1400px;
	margin: 0 auto;
	padding-bottom: 40px;
}

/* Panels */
.panel {
	background: var(--gradient-card);
	border-radius: var(--radius-lg);
	padding: 12px;
	box-shadow: var(--shadow-md);
	border: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
}



/* =================== */
/* CURRENCY RATE PANEL */
/* =================== */
.rate-panel {
	grid-column: 2;
	grid-row: 1;
	text-align: center;
	position: relative;
}

.current-price {
	background: var(--gradient-card);
	border-radius: var(--radius-lg);
	padding: 20px;
	margin-bottom: 20px;
	border: 1px solid var(--border-bright);
}

.price-value {
	font-size: 24px;
	font-weight: 700;
	color: var(--text-bright);
}

.price-value span {
	color: var(--accent-blue);
}

.price-value.loading {
	color: var(--accent-orange);
}

.positive {
	color: var(--accent-green);
}

.negative {
	color: var(--accent-red);
}

/* =================== */
/* WALLET PANEL     */
/* =================== */
.wallet-trading-panel {
	grid-column: 3;
	grid-row: 1 / 3;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 12px;
	position: relative;
}

.wallet-section {
	margin-bottom: 20px;
}

.trading-section {
	margin-top: auto;
	padding-top: 20px;
	border-top: 1px solid var(--border-bright);
	position: relative;
}


/* Balance cards */
.balance {
	margin: 12px 0;
	padding: 16px;
	background: var(--gradient-card);
	border-radius: var(--radius-md);
	border: 1px solid var(--border-bright);
}

.balance span {
	font-weight: 700;
	color: var(--text-bright);
	font-size: 16px;
}

.wallet-trading-panel h2 {
	font-size: 18px;
	margin-bottom: 16px;
}

.wallet-trading-panel h3 {
	font-size: 15px;
	margin: 12px 0 8px;
}

/* =================== */
/* FORMS AND BUTTONS      */
/* =================== */
input, button {
	width: 100%;
	padding: 14px 16px;
	margin: 8px 0;
	border-radius: var(--radius-md);
	font-size: 14px;
}

input {
	border: 1px solid var(--border);
	background: var(--bg-card);
	color: var(--text-secondary);
}

input:focus {
	outline: none;
	border-color: var(--accent-blue);
	color: var(--text-bright);
}

input::placeholder {
	color: var(--text-muted);
}

button {
	border: none;
	font-weight: 600;
	cursor: pointer;
	color: var(--text-bright);
	background: var(--gradient-primary);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}


button.buy, button#view-balance {
	background: var(--gradient-success);
}

button.sell {
	background: var(--gradient-danger);
}

button.login-btn {
	background: linear-gradient(135deg, var(--accent-orange), var(--accent-purple));
}

button:disabled, .disabled-btn {
	background: linear-gradient(135deg, #444, #333) !important;
	color: var(--text-muted) !important;
	cursor: not-allowed !important;
	opacity: 0.5 !important;
}


/* =================== */
/* MARKET ACTIVITY */
/* =================== */
.market-activity-panel {
	grid-column: 2;
	grid-row: 2;
	display: flex;
	flex-direction: column;
}

.market-activity-panel h2 {
	display: flex;
	align-items: center;
	gap: 12px;
}

.market-activity {
	overflow-y: auto;
	flex: 1;
	padding-bottom: 8px;
}

.market-order {
	padding: 12px 16px;
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	border-radius: var(--radius-md);
	margin: 4px 0;
}

.market-order.buy {
	background: linear-gradient(135deg, rgba(63, 185, 80, 0.2), rgba(57, 208, 216, 0.1));
	border: 1px solid rgba(63, 185, 80, 0.4);
}

.market-order.sell {
	background: linear-gradient(135deg, rgba(248, 81, 73, 0.2), rgba(255, 140, 0, 0.1));
	border: 1px solid rgba(248, 81, 73, 0.4);
}


.market-headers {
	display: flex;
	justify-content: space-between;
	padding: 12px 16px;
	font-weight: 600;
	font-size: 12px;
	background: var(--gradient-card);
	border: 1px solid var(--border-bright);
	margin-bottom: 8px;
	border-radius: var(--radius-md);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.market-headers span, .market-order span {
	flex: 1;
	text-align: center;
	font-weight: 500;
}

.blink {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--accent-red);
}

.blink::before {
	content: '';
	width: 8px;
	height: 8px;
	background: var(--accent-red);
	border-radius: 50%;
}



/* =================== */
/* POPUPS              */
/* =================== */
.popup {
	display: none;
	position: fixed;
	z-index: 1000;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
}

.popup-content {
	position: relative;
	background: linear-gradient(135deg, var(--bg-secondary), #0f1419);
	margin: 15% auto;
	padding: 25px;
	border: 1px solid var(--border);
	border-radius: 16px;
	width: 80%;
	max-width: 500px;
}

.close-popup {
	position: absolute;
	top: 10px;
	right: 15px;
	color: var(--text-muted);
	font-size: 28px;
	font-weight: bold;
	cursor: pointer;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	z-index: 1000;
}

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

.form-group {
	margin-bottom: 20px;
}

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

.popup h2 {
	font-size: 22px;
	margin-bottom: 20px;
}

.popup-buttons {
	display: flex;
	gap: 20px;
	margin-top: 25px;
}

.popup-buttons button {
	flex: 1;
}

.error-message {
	color: var(--accent-red);
	margin-top: 15px;
	text-align: center;
	min-height: 20px;
}

.balance-info, .transaction-status {
	background: linear-gradient(135deg, var(--bg-tertiary), #0f1419);
	border-radius: 12px;
	padding: 15px;
	border: 1px solid var(--border);
}

.balance-info {
	margin-bottom: 20px;
}

.balance-item {
	display: flex;
	justify-content: space-between;
	padding: 12px 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.balance-item:last-child {
	border-bottom: none;
}

.balance-label, .status-label {
	color: var(--text-muted);
}

.balance-value {
	color: var(--text-primary);
	font-weight: bold;
}

.transaction-status {
	margin-top: 15px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.status-value {
	color: var(--accent-orange);
	font-weight: bold;
}

/* =================== */
/* MARKET DEPTH    */
/* =================== */
.market-depth-panel {
	grid-column: 1;
	grid-row: 1 / 3;
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
}

.market-depth {
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex-grow: 1;
	height: 100%;
}

.depth-side {
	background: linear-gradient(135deg, var(--bg-tertiary), #0f1419);
	border-radius: 12px;
	padding: 12px;
	font-size: 12px;
	flex: 1;
	display: flex;
	flex-direction: column;
	border: 1px solid rgba(255, 255, 255, 0.05);
	min-height: 200px;
	max-height: 50%;
}

.depth-headers {
	display: flex;
	justify-content: space-between;
	padding: 5px 0;
	font-weight: bold;
	font-size: 11px;
	border-bottom: 2px solid #555;
	margin-bottom: 5px;
}

.orders-container {
	overflow-y: auto;
	flex-grow: 1;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

.orders-container::-webkit-scrollbar {
	width: 6px;
}

.orders-container::-webkit-scrollbar-track {
	background: rgba(255, 255, 255, 0.05);
	border-radius: 3px;
}

.orders-container::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 3px;
}

.depth-item {
	display: flex;
	justify-content: space-between;
	padding: 8px 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
	font-size: 11px;
	border-radius: 8px;
	margin: 2px 0;
}

.depth-item.buy {
	color: var(--accent-green);
}

.depth-item.sell {
	color: var(--accent-red);
}

.depth-headers span, .depth-item span {
	flex: 1;
	text-align: center;
}



/* =================== */
/* MOBILE VERSION    */
/* =================== */
@media (max-width: 768px) {
	body {
		padding: 5px;
	}

	.logo-img {
		width: 30px;
		height: 15px;
	}

	.container {
		display: flex;
		flex-direction: column;
		gap: 12px;
		height: auto;
		min-height: calc(120vh - 80px);
		padding-bottom: 60px;
	}

	.panel {
		padding: 10px;
	}

	.rate-panel {
		order: 1;
		height: 400px;
	}

	.tradingview-widget-container,
	.tradingview-widget-container__widget {
		height: 340px !important;
	}

	.wallet-trading-panel {
		order: 2;
	}

	.market-depth-panel {
		order: 3;
	}

	.market-activity-panel {
		display: none;
	}

	input, button {
		padding: 12px;
		font-size: 14px;
		min-height: 44px;
	}
}

@media (max-width: 480px) {
	.rate-panel {
		height: 340px;
	}

	.tradingview-widget-container,
	.tradingview-widget-container__widget {
		height: 300px !important;
	}
}