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

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.login-screen,
.main-app {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    padding: 30px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.login-screen {
    max-width: 700px;
    margin: 30px auto;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.warning-box {
    background: linear-gradient(45deg, #ff9a9e, #fecfef);
    border: 2px solid #ff6b9d;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.warning-box h3 {
    color: #d63384;
    margin-bottom: 10px;
}

/* Tabs Styling */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e1e5e9;
}

.tab-button {
    padding: 15px 30px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    color: #667eea;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

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

.section {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.section-title {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 15px;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.form-row {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 10px;
}

.form-row.wrap {
    flex-wrap: wrap;
}

.form-row label {
    min-width: 120px;
    font-weight: 600;
}

input,
select,
textarea {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.2);
}

.input-wide {
    flex: 1;
    min-width: 200px;
}

.input-medium {
    width: 150px;
}

.input-small {
    width: 100px;
}

/* Symbol Search Styling */
.symbol-search-container {
    position: relative;
    flex: 1;
}

.symbol-search-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
}

.symbol-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e1e5e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.symbol-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.symbol-option:hover {
    background-color: #f8f9fa;
}

.symbol-option.highlighted {
    background-color: #667eea;
    color: white;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #11998e, #38ef7d);
    color: white;
}

.btn-danger {
    background: linear-gradient(45deg, #fc466b, #3f5efb);
    color: white;
}

.btn-warning {
    background: linear-gradient(45deg, #ff9a9e, #fecfef);
    color: #333;
}

.btn-info {
    background: linear-gradient(45deg, #a8edea, #fed6e3);
    color: #333;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

.status-labels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.status-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid;
    text-align: center;
}

.status-card.buy {
    border-left-color: #11998e;
}

.status-card.sell {
    border-left-color: #fc466b;
}

.status-card.balance {
    border-left-color: #667eea;
}

.profile-list {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    max-height: 120px;
    overflow-y: auto;
    margin: 10px 0;
}

.profile-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
    font-size: 14px;
}

.profile-item:hover {
    background-color: #e9ecef;
}

.profile-item.selected {
    background-color: #667eea;
    color: white;
}

.profile-item.profile-empty {
    text-align: center;
    color: #666;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
}

.checkbox-container input[type="checkbox"] {
    transform: scale(1.2);
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
}

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

.hidden {
    display: none !important;
}

.success-text {
    color: #11998e;
    font-weight: 600;
}

.error-text {
    color: #fc466b;
    font-weight: 600;
}

.warning-text {
    color: #ff9a9e;
    font-weight: 600;
}

.info-text {
    color: #667eea;
    font-weight: 600;
}

.auto-controls {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    justify-content: center;
}

.trading-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
    flex-wrap: wrap;
}

/* Enhanced Trading Info Display */
.trading-info {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.1);
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.info-title {
    font-size: 1.5em;
    font-weight: bold;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.info-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.info-item:hover {
    transform: translateY(-2px);
}

.info-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.2em;
    font-weight: bold;
}

.trade-log {
    background: #1e1e1e;
    border-radius: 10px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid #333;
}

.log-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #333;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.log-time {
    color: #888;
    min-width: 80px;
}

.log-message {
    flex: 1;
    margin-left: 10px;
}

.log-success {
    color: #00ff88;
}

.log-error {
    color: #ff4444;
}

.log-warning {
    color: #ffaa00;
}

.log-info {
    color: #44aaff;
}

/* Header flex layout */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.futures-title {
    color: #667eea;
}

/* Account info grid */
.account-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.account-balance-card {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

/* ===== RESPONSIVE MOBILE DESIGN ===== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .container {
        padding: 10px;
    }

    .login-screen,
    .main-app {
        padding: 15px;
        border-radius: 10px;
        margin: 10px auto;
    }

    .header h1 {
        font-size: 2em;
    }

    .header h2 {
        font-size: 1.3em;
    }

    /* Form layouts */
    .form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .form-row label {
        min-width: auto;
        margin-bottom: 5px;
        font-size: 0.9em;
    }

    .form-row.wrap {
        flex-direction: column;
    }

    /* Input fields */
    input,
    select,
    textarea {
        width: 100%;
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .input-wide,
    .input-medium,
    .input-small {
        width: 100%;
        min-width: auto;
    }

    /* Buttons */
    .btn {
        padding: 12px 16px;
        font-size: 13px;
        width: 100%;
        margin-bottom: 8px;
    }

    .btn-small {
        padding: 10px 12px;
        font-size: 12px;
    }

    .auto-controls,
    .trading-controls {
        flex-direction: column;
        gap: 8px;
    }

    /* Section titles */
    .section-title {
        font-size: 1.1em;
        flex-wrap: wrap;
    }

    .section {
        padding: 15px;
        margin-bottom: 15px;
    }

    /* Status cards */
    .status-labels {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .status-card {
        padding: 12px;
    }

    /* Profile list */
    .profile-list {
        max-height: 100px;
    }

    /* Trading info */
    .trading-info {
        padding: 15px;
    }

    .info-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .info-title {
        font-size: 1.2em;
        text-align: center;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .info-item {
        padding: 12px;
    }

    /* Trade log */
    .trade-log {
        max-height: 200px;
        padding: 10px;
    }

    .log-entry {
        flex-direction: column;
        align-items: flex-start;
        padding: 6px 0;
        gap: 4px;
    }

    .log-time {
        min-width: auto;
        font-size: 11px;
    }

    .log-message {
        margin-left: 0;
        font-size: 12px;
        word-break: break-word;
    }

    /* Symbol dropdown */
    .symbol-dropdown {
        max-height: 150px;
    }

    .symbol-option {
        padding: 8px 10px;
        font-size: 13px;
    }

    /* Account info */
    .account-info-grid {
        grid-template-columns: 1fr;
    }

    /* Warning box */
    .warning-box {
        padding: 15px;
        margin: 15px 0;
    }

    .warning-box h3 {
        font-size: 1em;
    }

    .warning-box p {
        font-size: 0.9em;
    }

    /* Tabs */
    .tabs {
        flex-wrap: wrap;
        justify-content: center;
    }

    .tab-button {
        padding: 10px 15px;
        font-size: 14px;
        flex: 1;
        min-width: 100px;
    }

    /* Checkbox containers */
    .checkbox-container {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }

    .checkbox-container label {
        font-size: 0.9em;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5em;
    }

    .btn {
        font-size: 12px;
        padding: 10px 12px;
    }

    .section-title {
        font-size: 1em;
    }

    .info-title {
        font-size: 1em;
    }

    .status-card h4 {
        font-size: 0.9em;
    }

    .log-entry {
        font-size: 11px;
    }

    .trade-log {
        max-height: 150px;
    }
}

/* Landscape phones */
@media (max-width: 768px) and (orientation: landscape) {
    .trading-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .btn {
        width: auto;
        flex: 1;
        min-width: 120px;
    }

    .status-labels {
        grid-template-columns: repeat(3, 1fr);
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }

    .btn:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }

    .symbol-option:hover {
        background-color: transparent;
    }

    .symbol-option:active {
        background-color: #667eea;
        color: white;
    }

    .profile-item:hover {
        background-color: transparent;
    }

    .profile-item:active {
        background-color: #e9ecef;
    }
}

/* Dark mode support for mobile */
@media (prefers-color-scheme: dark) {
    .trade-log {
        background: #2d2d2d;
        border-color: #555;
    }

    .log-entry {
        border-bottom-color: #555;
    }
}