/* DoroTracker shared styles */

/* --- Base body / typography --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
    background: #f5f5f5;
    color: #333;
}

h1, h2, h3 { color: #333; }

a { color: #5C6BC0; }

/* --- Nav bar --- */
.nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ddd;
}

.nav h1 {
    margin: 0;
    font-size: 22px;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
}

.nav-links a {
    color: #999;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.nav-links a:hover {
    color: #666;
}

.nav-links a.active {
    color: #5C6BC0;
    font-weight: 600;
}

@media (max-width: 600px) {
    .nav {
        flex-direction: column;
        align-items: flex-start;
    }
    .nav-links {
        gap: 6px 12px;
    }
    .nav-links a {
        font-size: 13px;
    }
    body {
        padding: 8px;
    }
    .card, .status, .history {
        padding: 12px;
    }
    .schedule-form {
        flex-direction: column;
        align-items: stretch;
    }
    .ringer-buttons {
        flex-wrap: wrap;
    }
}

/* --- Cards --- */
.card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Also keep .status as a card alias for dashboard compatibility */
.status {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- Info table (label:value pairs) --- */
.info-table {
    border-collapse: collapse;
    width: 100%;
}

.info-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.info-table td:first-child {
    font-weight: 600;
    width: 120px;
    color: #666;
}

/* Plain table inside .status/.card sections */
.status table,
.card table {
    border-collapse: collapse;
    width: 100%;
}

.status table td,
.card table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.status table td:first-child,
.card table td:first-child {
    font-weight: 600;
    width: 120px;
    color: #666;
}

/* --- Data table (data grids: history, etc.) --- */
.data-table {
    border-collapse: collapse;
    width: 100%;
}

.data-table th {
    text-align: left;
    padding: 8px;
    border-bottom: 2px solid #ddd;
    font-size: 13px;
    color: #666;
}

.data-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    font-weight: normal;
}

.data-table td:first-child {
    width: auto;
}

/* --- Ringer badges --- */
.ringer-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
}

.ringer-normal {
    background: #e8f5e9;
    color: #2e7d32;
}

.ringer-vibrate {
    background: #fff3e0;
    color: #ef6c00;
}

.ringer-silent {
    background: #fce4ec;
    color: #c62828;
}

/* --- Ringer control buttons --- */
.ringer-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-ringer {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: white;
}

.btn-ringer:hover {
    border-color: #5C6BC0;
}

.btn-normal { color: #2e7d32; }
.btn-vibrate { color: #ef6c00; }
.btn-silent { color: #c62828; }

.pending {
    color: #ef6c00;
    font-size: 14px;
    font-weight: normal;
}

/* --- Schedule form --- */
.schedule-table {
    margin-bottom: 16px;
}

.schedule-table th {
    text-align: left;
    padding: 8px;
    border-bottom: 2px solid #ddd;
    font-size: 13px;
    color: #666;
}

.schedule-table td {
    font-weight: normal;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.schedule-table td:first-child {
    width: auto;
}

.schedule-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.schedule-form select,
.schedule-form input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* --- Buttons --- */
.btn-primary {
    padding: 8px 16px;
    background: #5C6BC0;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary:hover {
    background: #4a5ab5;
}

.btn-danger {
    padding: 4px 10px;
    background: #ef5350;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-secondary {
    padding: 8px 16px;
    background: #eee;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary:hover {
    background: #ddd;
}

.btn-mute {
    padding: 2px 8px;
    background: #eee;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
}

.btn-mute:hover {
    background: #ddd;
}

/* Aliases for schedule add/delete matching old server.py classes */
.btn-add {
    padding: 8px 16px;
    background: #5C6BC0;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-add:hover {
    background: #4a5ab5;
}

.btn-delete {
    padding: 4px 10px;
    background: #ef5350;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-delete:hover {
    background: #d32f2f;
}

/* --- History --- */
.history {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

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

.history table td {
    font-size: 12px;
    font-weight: normal;
    padding: 3px 6px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.history table td:first-child {
    width: auto;
}

.history th {
    text-align: left;
    padding: 4px 6px;
    border-bottom: 2px solid #ddd;
    font-size: 11px;
    color: #666;
}

.muted-row {
    opacity: 0.4;
}

.history tr[data-lat]:not(.muted-row):hover {
    background: #fff3e0;
    cursor: pointer;
}

.hover-pin {
    background: #ef6c00;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}

/* --- Login --- */
.login-card {
    background: white;
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: 80px auto;
}

.login-card h1 {
    margin-top: 0;
}

.login-card input[type=password] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    margin-bottom: 16px;
}

.login-card button {
    width: 100%;
    padding: 12px;
    background: #5C6BC0;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

.login-card button:hover {
    background: #4a5ab5;
}

.error {
    color: #d32f2f;
    margin-bottom: 16px;
}

/* --- Launcher editor --- */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

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

.editor-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview-panel {
    position: sticky;
    top: 16px;
}

.btn-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s;
}

.btn-card:hover {
    border-color: #5C6BC0;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.publish-bar {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid #ddd;
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin: 0 -16px -16px;
    border-radius: 0 0 8px 8px;
}

.validation-error {
    color: #d32f2f;
    font-size: 13px;
    margin-top: 4px;
}

.validation-warning {
    color: #ef6c00;
    font-size: 13px;
    margin-top: 4px;
}

/* Phone preview frame */
.phone-frame {
    background: #222;
    border-radius: 24px;
    padding: 12px;
    width: 280px;
    margin: 0 auto;
}

.phone-screen {
    background: #f5f5f5;
    border-radius: 16px;
    padding: 16px;
    min-height: 400px;
}

.phone-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.phone-button {
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 10px 4px;
    text-align: center;
    font-size: 11px;
    word-break: break-word;
}

.phone-button .icon {
    font-size: 28px;
    display: block;
    margin-bottom: 4px;
}

/* --- Version history table --- */
.version-table {
    border-collapse: collapse;
    width: 100%;
}

.version-table th {
    text-align: left;
    padding: 8px;
    border-bottom: 2px solid #ddd;
    font-size: 13px;
    color: #666;
}

.version-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.ver-num {
    font-weight: 600;
    color: #5C6BC0;
}

.btn-sm {
    padding: 3px 8px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    color: #5C6BC0;
}

.btn-sm:hover {
    background: #f0f0f0;
}
