/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    color: #333;
}

/* Mode selection styles */
.mode-selection {
    text-align: center;
    margin: 2rem auto;
    max-width: 400px;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mode-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.mode-buttons button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    border: 2px solid #007bff;
    background-color: white;
    color: #007bff;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mode-buttons button:hover {
    background-color: #007bff;
    color: white;
}

/* Main interface styles */
.main-interface {
    max-width: 1200px;
    margin: 0 auto;
}

.app-header {
    margin-bottom: 2rem;
}

/* Connection status styles */
.connection-status {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #dc3545;
}

.status-dot.connected {
    background-color: #28a745;
}

/* Radio control section */
.radio-control {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.radio-selection {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.radio-selection select {
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
}

.primary-button {
    padding: 0.5rem 1rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.primary-button:hover {
    background-color: #0056b3;
}

/* Frequency and mode controls */
.radio-controls {
    display: grid;
    gap: 1.5rem;
}

.frequency-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.frequency-input {
    font-size: 1.2rem;
    padding: 0.5rem;
    width: 150px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.mode-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mode-buttons {
    display: flex;
    gap: 0.5rem;
}

.mode-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ced4da;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Debug panel */
.debug-panel {
    margin-top: 1.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    overflow: hidden;
}

.debug-panel summary {
    padding: 0.75rem;
    background-color: #f8f9fa;
    cursor: pointer;
    font-weight: 500;
}

.debug-info {
    padding: 1rem;
    background-color: #fff;
}

.debug-item {
    margin-bottom: 0.75rem;
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1rem;
}

.debug-item:last-child {
    margin-bottom: 0;
}

/* POTA section */
.pota-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.activator-table {
    width: 100%;
    border-collapse: collapse;
}

.activator-table th,
.activator-table td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    text-align: left;
}

.activator-table th {
    background-color: #f8f9fa;
    font-weight: 500;
}

.activator-table tr:hover {
    background-color: #f8f9fa;
}

.tune-button {
    padding: 0.375rem 0.75rem;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.tune-button:hover {
    background-color: #218838;
}

.tune-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Frequency Control Pad styles */
.freq-control-pad {
    margin: 2rem 0;
    display: none; /* Hidden by default */
    justify-content: center;
    touch-action: none;
}

.freq-pad {
    position: relative;
    width: 280px;
    height: 280px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    touch-action: none;
}

.pad-button {
    position: absolute;
    background: none;
    border: none;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s;
    color: #666;
    padding: 0;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.pad-button:focus {
    outline: none;
}

.pad-button.active {
    color: #007bff;
}

.pad-button .arrow {
    font-size: 32px;
    line-height: 1;
}

.pad-button .label {
    font-size: 14px;
    margin-top: 4px;
}

.pad-up {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.pad-down {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.pad-left {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.pad-right {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.pad-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #e9ecef;
    border-radius: 50%;
}

/* Operator Info */
.operator-info {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 4px;
}

.callsign-input, .gridsquare-input {
    flex: 1;
}

.callsign-input input, .gridsquare-input input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    text-transform: uppercase;
}

/* QSO Form */
.qso-form-row {
    background-color: #f8f9fa;
}

.qso-form {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
}

.qso-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-group input[type="text"] {
    width: 100%;
}

.qso-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.save-qso,
.cancel-qso {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.save-qso {
    background-color: #28a745;
    color: white;
}

.save-qso:hover {
    background-color: #218838;
}

.cancel-qso {
    background-color: #dc3545;
    color: white;
}

.cancel-qso:hover {
    background-color: #c82333;
}

.log-button {
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.log-button:hover {
    background-color: #138496;
}

/* Status message for QSO logging */
.qso-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem;
    border-radius: 4px;
    color: white;
    background-color: #28a745;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.qso-status-duplicate {
    color: #0d6efd;  /* Bootstrap primary blue */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* QSO Log Table */
.qso-log-section {
    margin: 2rem 0;
}

.qso-table-container {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.qso-log-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.qso-log-table th,
.qso-log-table td {
    padding: 0.5rem;
    text-align: left;
    border: 1px solid #dee2e6;
}

.qso-log-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.qso-log-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.qso-log-table tbody tr:hover {
    background-color: #e9ecef;
}

.qso-log-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.sync-qrz-button {
    padding: 0.5rem 1rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.sync-qrz-button:hover {
    background-color: #0056b3;
}

.sync-qrz-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.sync-status {
    font-size: 0.9rem;
}

.sync-status.success {
    color: #28a745;
}

.sync-status.error {
    color: #dc3545;
}

.qrz-key-input {
    flex: 1;
}

.qrz-key-input input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

/* QSO Status indicators */
.qso-status-pending {
    color: #6c757d;
}

.qso-status-synced {
    color: #28a745;
}

.qso-status-error {
    color: #dc3545;
}

.qso-status-replaced {
    color: #ffc107;
}

/* Clear QSO Log button */
.clear-log-button {
    padding: 0.5rem 1rem;
    background-color: #dc3545;  /* Bootstrap danger red */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.clear-log-button:hover {
    background-color: #bb2d3b;  /* Darker red */
}

.clear-log-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Responsive styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .radio-selection {
        flex-direction: column;
        align-items: stretch;
    }

    .frequency-control {
        flex-direction: column;
        align-items: flex-start;
    }

    .mode-buttons {
        flex-wrap: wrap;
    }

    /* POTA table responsive styles */
    .activator-table thead th,
    .activator-table tbody td {
        display: none;
    }

    .activator-table th:nth-child(1),
    .activator-table th:nth-child(2),
    .activator-table th:nth-child(3),
    .activator-table th:nth-child(7),
    .activator-table td:nth-child(1),
    .activator-table td:nth-child(2),
    .activator-table td:nth-child(3),
    .activator-table td:nth-child(7) {
        display: table-cell;
        padding: 0.5rem;
    }
    
    /* RBN spots table responsive styles */
    .spots-table thead th,
    .spots-table tbody td {
        display: none;
    }

    .spots-table th:nth-child(1),
    .spots-table th:nth-child(2),
    .spots-table th:nth-child(4),
    .spots-table th:nth-child(7),
    .spots-table td:nth-child(1),
    .spots-table td:nth-child(2),
    .spots-table td:nth-child(4),
    .spots-table td:nth-child(7) {
        display: table-cell;
        padding: 0.5rem;
    }

    .table-container {
        margin: 0 -1rem;
        overflow-x: auto;
        padding: 0 1rem;
    }

    .activator-table {
        font-size: 0.9rem;
    }
    
    /* Simple styling for action buttons on mobile */
    @media (max-width: 480px) {
        .action-buttons {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }
    }

    /* Make the pad slightly smaller on very small screens */
    @media (max-width: 360px) {
        .freq-pad {
            width: 240px;
            height: 240px;
        }
        
        .pad-button {
            width: 70px;
            height: 70px;
        }
    }
}

/* Show frequency pad in remote mode or on mobile */
.remote-mode .freq-control-pad {
    display: flex;
}

@media (max-width: 767px) {
    .radio-mode .freq-control-pad {
        display: flex;
    }
}