* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #e8f0f7;
    min-height: 100vh;
    color: #2c3e50;
}

/* Telegram WebApp Auth Overlay */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e8f0f7;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.auth-loading {
    text-align: center;
}

.auth-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #d0dfe9;
    border-top: 4px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.auth-loading p {
    color: #6c7a89;
    font-size: 16px;
}

.auth-overlay.error .auth-loading p {
    color: #e74c3c;
}

.auth-overlay.hidden {
    display: none;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(74, 144, 226, 0.15);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-box h1 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.login-box p {
    color: #7a8a9e;
    margin-bottom: 30px;
}

.login-box input {
    width: 100%;
    padding: 12px;
    border: 2px solid #d0dfe9;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: border-color 0.3s;
    background: #f8fbfd;
    color: #2c3e50;
}

.login-box input:focus {
    outline: none;
    border-color: #4a90e2;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.login-box button:hover {
    background: #357abd;
}

.error-message {
    color: #e74c3c;
    margin-top: 15px;
    font-size: 14px;
}

/* Main Editor */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Desktop: wider container for more comfortable editing */
@media (min-width: 1440px) {
    .container {
        max-width: 1200px;
    }
}

/* Laptop: comfortable reading width */
@media (min-width: 1024px) and (max-width: 1439px) {
    .container {
        max-width: 900px;
    }
}

/* Tablet and below: full width with padding */
@media (max-width: 1023px) {
    .container {
        max-width: 100%;
        padding: 15px;
    }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
}

header h1 {
    color: #2c3e50;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    background: #95a5a6;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 15px;
}

.info-banner {
    background: #d6e8f7;
    border-left: 3px solid #4a90e2;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.info-banner p {
    margin: 0;
    color: #5a6c7d;
    font-size: 13px;
}

.logout-btn {
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #c0392b;
}

.editor-panel {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.12);
    width: 100%;
}

.editor-panel h2 {
    margin-bottom: 25px;
    color: #4a90e2;
    border-bottom: 2px solid #4a90e2;
    padding-bottom: 10px;
}

/* Mobile: reduce padding */
@media (max-width: 768px) {
    .editor-panel {
        padding: 25px 20px;
    }
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #d0dfe9;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
    background: #f8fbfd;
    color: #2c3e50;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4a90e2;
}

.form-group select {
    cursor: pointer;
    background-color: #f8fbfd;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: #7f8c8d;
}

/* Image Upload */
.image-upload-area {
    position: relative;
    border: 2px dashed #c0d4e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.3s;
    cursor: pointer;
    background: #f8fbfd;
}

.image-upload-area:hover {
    border-color: #4a90e2;
}

.image-upload-area.dragover {
    border-color: #4a90e2;
    background: #e8f4fc;
}

.upload-placeholder {
    padding: 40px 20px;
    color: #7f8c8d;
}

.images-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.image-preview-item .remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 25px;
    height: 25px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    z-index: 10;
}

.image-preview-item .remove-image:hover {
    background: #c0392b;
}

.image-count-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 10px;
    background: #3498db;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Rich Text Editor */
.toolbar {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    padding: 10px;
    background: #f5f9fc;
    border-radius: 8px 8px 0 0;
    border: 2px solid #d0dfe9;
    border-bottom: none;
}

.toolbar-btn {
    padding: 8px 12px;
    background: white;
    border: 1px solid #d0dfe9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    color: #2c3e50;
}

.toolbar-btn:hover {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.toolbar-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.editor-area {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    border: 2px solid #d0dfe9;
    border-radius: 0 0 8px 8px;
    font-size: 15px;
    line-height: 1.6;
    transition: border-color 0.3s;
    background: white;
    color: #2c3e50;
}

.editor-area:focus {
    outline: none;
    border-color: #4a90e2;
}

.editor-area[placeholder]:empty:before {
    content: attr(placeholder);
    color: #95a5a6;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

.button-group-three {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

.btn {
    padding: 14px 40px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 200px;
}

@media (max-width: 480px) {
    .btn {
        min-width: 100%;
    }
}

.btn-primary {
    background: #4a90e2;
    color: white;
}

.btn-primary:hover {
    background: #357abd;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-schedule {
    background: #9b59b6;
    color: white;
}

.btn-schedule:hover {
    background: #8e44ad;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3);
}

/* Time preset buttons - override min-width */
.btn.btn-time-preset {
    min-width: unset !important;
    width: 52px !important;
    padding: 6px 4px !important;
    font-size: 13px !important;
}

/* Messages */
.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Rarity Options */
.rarity-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rarity-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.rarity-option:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.rarity-option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
}

.rarity-option input[type="radio"]:checked + .rarity-label {
    font-weight: 600;
}

.rarity-option:has(input[type="radio"]:checked) {
    border-color: #3498db;
    background: #e3f2fd;
}

.rarity-label {
    font-size: 16px;
    cursor: pointer;
}

/* Tabs */
.tabs-container {
    margin-bottom: 20px;
}

.tabs-nav {
    display: flex;
    gap: 10px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 14px 20px;
    background: #f5f9fc;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #5a6c7d;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #e8f4fc;
    color: #2c3e50;
}

.tab-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Posts Panel */
.posts-panel, .income-panel, .achievements-panel {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.1);
}

.posts-panel h2, .income-panel h2, .achievements-panel h2 {
    margin-bottom: 25px;
    color: #4a90e2;
    border-bottom: 2px solid #4a90e2;
    padding-bottom: 10px;
}

.filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.filter-select, .filter-input {
    padding: 10px 15px;
    border: 2px solid #d0dfe9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: #f8fbfd;
    color: #2c3e50;
}

.filter-select {
    min-width: 150px;
    cursor: pointer;
}

.filter-input {
    flex: 1;
    min-width: 200px;
}

.filter-input::placeholder {
    color: #95a5a6;
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: #4a90e2;
}

.btn-refresh {
    padding: 10px 20px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background: #357abd;
}

/* Data Table */
.data-table {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid #e0e7ee;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Reduced from 800px for better mobile fit */
}

/* Mobile: make table more compact */
@media (max-width: 768px) {
    .data-table table {
        min-width: 500px;
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
}

/* Small phones: ultra-compact */
@media (max-width: 480px) {
    .data-table table {
        min-width: 420px;
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
}

.data-table th {
    background: #f5f9fc;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #34495e;
    border-bottom: 2px solid #d0dfe9;
    user-select: none;
}

.data-table th[onclick] {
    transition: background 0.2s;
}

.data-table th[onclick]:hover {
    background: #e8f4fc;
    color: #2c3e50;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid #e8eef5;
    color: #2c3e50;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: #f8fbfd;
}

.loading-text {
    padding: 40px;
    text-align: center;
    color: #7f8c8d;
}

.status-badge-active {
    display: inline-block;
    padding: 4px 10px;
    background: #27ae60;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge-finished {
    display: inline-block;
    padding: 4px 10px;
    background: #95a5a6;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Mobile: 2 columns */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* Small phones: 1 column */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: #f8fbfd;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid #d0dfe9;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: #4a90e2;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.stat-label {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Mobile: single column for better chart visibility */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e0e7ee;
}

.chart-card h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.chart-card canvas {
    max-height: 300px;
    width: 100% !important;
    height: auto !important;
}

/* Mobile: more compact charts */
@media (max-width: 768px) {
    .chart-card {
        padding: 20px 15px;
    }

    .chart-card canvas {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .chart-card {
        padding: 15px 10px;
    }

    .chart-card h3 {
        font-size: 14px;
    }

    .chart-card canvas {
        max-height: 200px;
    }
}

/* Top Auctions */
.top-auctions {
    margin-top: 30px;
}

.top-auctions h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

/* Mobile Responsive Updates */
@media (max-width: 768px) {
    /* Tabs */
    .tabs-nav {
        flex-direction: column;
        gap: 8px;
    }

    .tab-btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
    }

    /* Filters */
    .filters-bar {
        flex-direction: column;
        gap: 10px;
    }

    .filter-select, .filter-input {
        width: 100%;
        min-width: 100%;
    }

    /* Header */
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px;
    }

    header h1 {
        font-size: 24px;
    }

    /* Posts and Income panels */
    .posts-panel, .income-panel {
        padding: 20px 15px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 15px;
    }

    header h1 {
        font-size: 20px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 22px;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
    }
}

/* Export Section */
.export-section {
    margin-top: 40px;
    padding: 25px;
    background: #f8fbfd;
    border-radius: 12px;
    border: 2px solid #d0dfe9;
}

.export-section h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.export-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.date-range-selector {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.date-inputs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.date-input {
    padding: 12px;
    border: 2px solid #d0dfe9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: white;
    color: #2c3e50;
}

.date-input:focus {
    outline: none;
    border-color: #4a90e2;
}

.quick-period-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.period-btn {
    padding: 12px 16px;
    background: white;
    color: #4a90e2;
    border: 2px solid #4a90e2;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.period-btn:hover {
    background: #4a90e2;
    color: white;
}

.period-btn.active {
    background: #4a90e2;
    color: white;
}

.export-btn {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    align-self: center;
    min-width: 300px;
}

/* Mobile responsive for export section */
@media (max-width: 768px) {
    .date-inputs {
        grid-template-columns: 1fr;
    }

    .quick-period-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .export-btn {
        min-width: 100%;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .export-section {
        padding: 15px;
    }

    .quick-period-buttons {
        grid-template-columns: 1fr;
    }

    .period-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Templates Section */
.templates-section {
    padding-top: 30px;
    border-top: 2px solid #d0dfe9;
}

.templates-section h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
}

.templates-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.template-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #d0dfe9;
    transition: all 0.3s;
    cursor: pointer;
}

.template-card:hover {
    border-color: #4a90e2;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.template-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.template-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.template-card-date {
    font-size: 12px;
    color: #7a8a9e;
}

.template-card-actions {
    display: flex;
    gap: 8px;
}

.template-action-btn {
    padding: 6px 10px;
    background: #f8fbfd;
    border: 1px solid #d0dfe9;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #2c3e50;
}

.template-action-btn:hover {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.template-action-btn.delete {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.template-action-btn.delete:hover {
    background: #c0392b;
    border-color: #c0392b;
}

.template-card-preview {
    font-size: 14px;
    color: #5a6c7d;
    line-height: 1.4;
}

.template-card-preview p {
    margin: 5px 0;
}

.template-card-preview .preview-label {
    font-weight: 600;
    color: #7a8a9e;
}

/* Mobile responsive for templates */
@media (max-width: 768px) {
    .templates-list {
        grid-template-columns: 1fr;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.modal-content.modal-large {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #d0dfe9;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #7a8a9e;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 25px;
}

.modal-body label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #5a6c7d;
}

.modal-body input {
    width: 100%;
    padding: 12px;
    border: 2px solid #d0dfe9;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
    background: #f8fbfd;
    color: #2c3e50;
}

.modal-body input:focus {
    outline: none;
    border-color: #4a90e2;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 2px solid #d0dfe9;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-footer .btn {
    min-width: 120px;
    padding: 10px 20px;
}

/* Sort Bar */
.sort-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fbfd;
    border-radius: 8px;
    flex-wrap: wrap;
}

.sort-label {
    color: #5a6c7d;
    font-weight: 600;
    margin-right: 5px;
}

.sort-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #d0dfe9;
    border-radius: 6px;
    color: #5a6c7d;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.sort-btn:hover {
    background: #e8f0f7;
    color: #2c3e50;
    border-color: #4a90e2;
}

.sort-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

/* Mobile: stack sort buttons */
@media (max-width: 768px) {
    .sort-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-btn {
        width: 100%;
    }
}

/* ========================================
   Planning Mode Styles
   ======================================== */

/* Mode switcher button */
.mode-switcher-btn {
    background: #4a90e2;
    color: white;
    border: 2px solid #4a90e2;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-switcher-btn:hover {
    background: #357abd;
    border-color: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.mode-switcher-btn:active {
    transform: translateY(0);
}

/* Planning mode container - slight background change */
.container.planning-active {
    background: #dfe8f1;
    transition: background 0.3s ease;
}

.planning-mode {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Planning header with month navigation */
.planning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e8f0f7;
}

.planning-header h2 {
    font-size: 22px;
    color: #2c3e50;
    font-weight: 600;
}

.calendar-nav-btn {
    background: #f5f8fb;
    border: 2px solid #d0dfe9;
    color: #4a90e2;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

/* Calendar grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    color: #5a6c7d;
    padding: 10px;
    font-size: 14px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid #e8f0f7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f5f8fb;
    font-size: 15px;
    font-weight: 500;
    color: #2c3e50;
    position: relative;
    gap: 2px;
    padding: 4px;
}

.calendar-day .day-number {
    line-height: 1;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.calendar-day:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.calendar-day.other-month {
    color: #c0c0c0;
    background: #fafafa;
}

.calendar-day.today {
    border-color: #4a90e2;
    border-width: 3px;
    font-weight: 700;
}

/* Removed blue background for selected day - unnecessary with white padding */
/* .calendar-day.selected {
    background: #4a90e2;
    color: white;
    border-color: #357abd;
} */

.calendar-day.has-scheduled {
    background: #e8f5e9;
    border-color: #4caf50;
}

.scheduled-indicator {
    width: 18px;
    height: 18px;
    background: #4caf50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
    margin-top: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Empty indicator shows just a dot */
.scheduled-indicator:empty::before {
    content: '●';
    font-size: 12px;
}

.calendar-day:hover .scheduled-indicator {
    background: #ffffff;
    color: #4caf50;
}

/* Removed selected indicator styling - no longer needed without blue background */
/* .calendar-day.selected .scheduled-indicator {
    background: #ffffff;
    color: #4a90e2;
} */

/* Day View */
.day-view {
    animation: fadeIn 0.3s ease;
}

.day-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.day-view-header h3 {
    margin: 0;
    flex-grow: 1;
    text-align: center;
    color: #2c3e50;
    font-size: 20px;
}

.day-view-auctions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.day-view-auction-card {
    background: white;
    border: 2px solid #e8f0f7;
    border-radius: 8px;
    padding: 15px;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 15px;
    align-items: center;
    transition: all 0.2s ease;
}

/* Reduce gap on smaller devices */
@media (max-width: 600px) {
    .day-view-auction-card {
        gap: 10px;
        padding: 12px 10px;
    }

    /* Make "Перейти" button more compact on small screens */
    .auction-card-actions .btn-primary {
        padding: 8px 12px !important;
        font-size: 13px !important;
        min-width: auto !important;
        white-space: nowrap;
    }
}

.day-view-auction-card:hover {
    border-color: #4a90e2;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
}

.auction-card-time {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    min-width: 60px;
}

.auction-card-rarity {
    width: 4px;
    height: 100%;
    border-radius: 2px;
    position: absolute;
    left: 0;
    top: 0;
}

.auction-card-info {
    flex-grow: 1;
}

.auction-card-title {
    font-weight: 600;
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 4px;
}

.auction-card-details {
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.6;
}

.auction-card-details > div {
    margin-bottom: 2px;
}

.auction-card-actions {
    display: flex;
    gap: 8px;
}

.auction-status {
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.6;
}

.auction-status > div {
    margin-bottom: 2px;
}

/* Stack buttons vertically on small devices */
@media (max-width: 480px) {
    .auction-card-actions {
        flex-direction: column !important;
    }

    .auction-card-actions .btn {
        width: 100% !important;
        min-width: 100% !important;
        padding: 10px 16px !important;
        font-size: 14px !important;
    }
}

/* Also apply to slightly larger screens for better spacing */
@media (max-width: 600px) {
    .auction-card-actions {
        flex-direction: column !important;
    }

    .auction-card-actions .btn {
        width: 100% !important;
        min-width: 100% !important;
        padding: 10px 16px !important;
        font-size: 14px !important;
    }
}

.day-view-empty {
    text-align: center;
    padding: 40px;
    color: #95a5a6;
    font-size: 16px;
}

/* Planning form */
.planning-form {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #e8f0f7;
}

.planning-form h3 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 20px;
    font-weight: 600;
}

#selectedDateDisplay {
    color: #4a90e2;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .mode-switcher-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .planning-header h2 {
        font-size: 18px;
    }

    .calendar-grid {
        gap: 6px;
    }

    .calendar-day {
        font-size: 13px;
    }

    .calendar-nav-btn {
        padding: 6px 12px;
        font-size: 16px;
    }

    /* Day view header - stack vertically on smaller screens */
    .day-view-header {
        flex-direction: column;
        gap: 10px;
    }

    .day-view-header h3 {
        order: -1; /* Put title first */
        font-size: 18px;
    }

    .day-view-header button {
        width: 100%;
    }

    /* Form actions - maintain gap when stacked vertically */
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }

    .form-actions .btn {
        width: 100%;
        min-width: 100%;
    }

    /* Time preset buttons - widen slightly for better 2-row distribution */
    .btn.btn-time-preset {
        width: 55px !important;
    }
}

/* Extra small screens - optimize calendar cell size */
@media (max-width: 480px) {
    /* Reduce padding and margins to give calendar cells more space */
    .planning-mode {
        padding: 12px;
        margin: 10px 0;
    }

    /* Tighter calendar grid spacing for bigger cells */
    .calendar-grid {
        gap: 4px;
    }

    /* Reduce container padding for planning mode */
    #planningMode .container {
        padding: 8px;
    }

    /* Bigger time preset buttons for easier tapping on mobile */
    .btn.btn-time-preset {
        width: 73px !important;
        padding: 8px 5px !important;
        font-size: 17px !important;
    }
}
