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

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

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

header {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

header h1 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 15px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 12px;
    border-radius: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.user-controls:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.user-select {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 32px;
}

.user-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.user-select:hover {
    border-color: #cbd5e0;
}

.user-button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.user-button:active {
    transform: scale(0.95);
}

.user-button.delete {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

.user-button.delete:hover {
    box-shadow: 0 4px 8px rgba(245, 101, 101, 0.3);
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.date-display, .status-display, .remaining-display {
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
}

.date-display {
    background: #e6fffa;
    color: #234e52;
}

.status-display {
    background: #fed7d7;
    color: #742a2a;
}

.status-display.can-trade {
    background: #c6f6d5;
    color: #22543d;
}

.remaining-display {
    background: #bee3f8;
    color: #2c5282;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.trade-input, .trade-history, .rolling-summary {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.trade-input {
    grid-column: 1;
}

.trade-history {
    grid-column: 2;
    grid-row: 1;
}

.rolling-summary {
    grid-column: 1 / -1;
}

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

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #4a5568;
}

.input-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 5px;
    font-size: 16px;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.record-button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.record-button:hover {
    background: #5a67d8;
}

.record-button:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.trade-item {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.trade-date {
    color: #4a5568;
    font-weight: bold;
}

.trade-count {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.summary-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.summary-item {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.summary-date {
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 5px;
}

.summary-count {
    font-size: 24px;
    font-weight: bold;
    color: #2d3748;
}

.summary-count.limit-reached {
    color: #e53e3e;
}

.summary-count.under-limit {
    color: #38a169;
}

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

    .trade-history {
        grid-column: 1;
        grid-row: 2;
    }

    .status-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .header-top {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .user-controls {
        justify-content: center;
        margin-top: 10px;
    }

    .user-select {
        min-width: 140px;
        flex: 1;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 20px;
}

.modal-body .input-group {
    margin-bottom: 20px;
}

.modal-body .input-group input {
    margin-top: 8px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
}

.modal-btn.confirm {
    background: #667eea;
    color: white;
}

.modal-btn.confirm:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.modal-btn.cancel {
    background: #e2e8f0;
    color: #4a5568;
}

.modal-btn.cancel:hover {
    background: #cbd5e0;
}

.modal-btn:active {
    transform: translateY(0);
}