/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --navy: #002B49;
    --teal: #007a81;
    --purple: #6B2B6E;
    --light-gray: #F5F5F5;
    --border-gray: #E0E0E0;
    --text-dark: #333333;
    --text-light: #666666;
    --white: #FFFFFF;
    --red: #E53935;
    --green: #007a81;
    --orange: #FF9800;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-gray);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    max-width: 768px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    padding-bottom: 70px;
}

/* Header */
.app-header {
    background: var(--teal);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px var(--shadow);
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: white;
    background: var(--navy);
    padding: 6px 16px;
    border-radius: 0px;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 0px;
    transition: background 0.2s;
}

.language-selector:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Navigation Tiles */
.nav-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 20px;
}

.nav-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    border-radius: px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px var(--shadow);
}

.nav-tile:active {
    transform: scale(0.95);
}

.nav-tile i {
    font-size: 32px;
    margin-bottom: 8px;
}

.nav-tile.navy {
    background: var(--navy);
}

.nav-tile.teal {
    background: var(--teal);
}

.nav-tile.purple {
    background: var(--purple);
}

.badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

.badge-red {
    background: var(--red);
}

.badge-green {
    background: var(--green);
}

/* Content Sections */
.content-section {
    padding: 20px;
    border-bottom: 8px solid var(--light-gray);
}

.section-header {
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    display: inline;
}

.subtitle {
    color: var(--text-light);
    font-size: 14px;
    margin-left: 8px;
}

/* Filter Button */
.filter-button {
    width: 100%;
    padding: 12px;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-dark);
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 16px;
}

.filter-button:hover {
    background: var(--light-gray);
}

/* Machine Status List */
.machine-status-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-item {
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 0px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.status-item:active {
    transform: scale(0.98);
}

.status-icon {
    font-size: 24px;
}

.status-error .status-icon {
    color: var(--red);
}

.status-success .status-icon {
    color: var(--green);
}

.status-text {
    flex: 1;
    font-weight: 500;
}

.expand-icon {
    color: var(--text-light);
    transition: transform 0.2s;
}

.status-item.expanded .expand-icon {
    transform: rotate(90deg);
}

/* Calendar */
.calendar-container {
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: px;
    padding: 16px;
    margin-bottom: 16px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 16px;
}

.calendar-nav {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--teal);
    cursor: pointer;
    padding: 8px;
    transition: opacity 0.2s;
}

.calendar-nav:active {
    opacity: 0.6;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    font-weight: 600;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.calendar-day.other-month {
    color: var(--text-light);
    opacity: 0.5;
}

.calendar-day.today {
    background: var(--teal);
    color: white;
    font-weight: bold;
}

.calendar-day.selected {
    background: var(--navy);
    color: white;
    font-weight: bold;
}

.calendar-day.has-plan::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--teal);
}

.calendar-day.selected.has-plan::after {
    background: white;
}

.calendar-day:hover:not(.selected) {
    background: var(--light-gray);
}

.selected-date {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 16px;
}

/* Primary Button */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--teal);
    color: white;
    border: none;
    border-radius: 0px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    margin-bottom: 24px;
}

.btn-primary:active {
    background: #008c82;
}

/* Plans Section */
.plans-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.plan-item {
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 0px;
    padding: 16px;
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.plan-item.plan-finished {
    background: #E8F5E9;
    border-color: var(--green);
}

.plan-info {
    flex: 1;
}

.plan-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.plan-operator {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.plan-status {
    margin-bottom: 4px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: px;
    font-size: 12px;
    font-weight: 600;
}

.status-finished {
    background: var(--green);
    color: white;
}

.plan-timestamp {
    font-size: 12px;
    color: var(--text-light);
}

.plan-remove {
    background: none;
    border: none;
    color: var(--red);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: opacity 0.2s;
}

.plan-remove:active {
    opacity: 0.6;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 768px;
    margin: 0 auto;
    background: white;
    border-top: 1px solid var(--border-gray);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    box-shadow: 0 -2px 8px var(--shadow);
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 24px;
    padding: 8px 20px;
    text-decoration: none;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--teal);
}

.nav-item:active {
    opacity: 0.6;
}

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.card-icon {
    font-size: 32px;
    color: var(--teal);
}

.card-label {
    font-size: 14px;
    color: var(--text-light);
}

.card-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--text-dark);
}

.card-menu {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
}

/* Machine List */
.machine-list-header {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.view-toggle {
    display: flex;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 0px;
    overflow: hidden;
}

.view-toggle button {
    flex: 1;
    padding: 10px 20px;
    background: white;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle button.active {
    background: var(--teal);
    color: white;
}

.search-container {
    flex: 1;
    display: flex;
    gap: 8px;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border-gray);
    border-radius: 0px;
    font-size: 14px;
}

.btn-search {
    padding: 10px 20px;
    background: var(--teal);
    color: white;
    border: none;
    border-radius: 0px;
    font-weight: 600;
    cursor: pointer;
}

.status-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.status-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 0px;
    cursor: pointer;
    transition: all 0.2s;
}

.status-filter.active {
    box-shadow: 0 2px 8px var(--shadow);
}

.status-filter-ready {
    background: #E8F5E9;
    color: var(--green);
}

.status-filter-not-ready {
    background: #FFEBEE;
    color: var(--red);
}

.status-filter-decommissioned {
    background: var(--light-gray);
    color: var(--text-light);
}

.machine-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 0px;
    overflow: hidden;
}

.machine-table thead {
    background: var(--light-gray);
}

.machine-table th {
    padding: 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
}

.machine-table td {
    padding: 12px;
    border-top: 1px solid var(--border-gray);
    font-size: 14px;
}

.machine-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.machine-table tbody tr:hover {
    background: var(--light-gray);
}

.machine-serial {
    color: var(--teal);
    font-weight: 600;
}

.machine-status-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
}

.machine-status-icon.ready {
    background: var(--teal);
}

.machine-status-icon.not-ready {
    background: var(--red);
}

/* Ticket Stats */
.ticket-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: px;
    padding: 20px;
    position: relative;
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.stat-icon.red {
    color: var(--red);
}

.stat-icon.orange {
    color: var(--orange);
}

.stat-icon.green {
    color: var(--green);
}

.stat-icon.blue {
    color: var(--teal);
}

.stat-label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--text-dark);
}

/* Ticket Actions */
.ticket-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.btn-secondary {
    flex: 1;
    padding: 12px;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 0px;
    color: var(--text-dark);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-secondary:active {
    background: var(--light-gray);
}

.btn-secondary.active {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
}

/* Ticket List */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ticket-list-item {
    background: white;
    border-left: 4px solid;
    border-radius: 0px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px var(--shadow);
}

.ticket-list-item:active {
    transform: scale(0.98);
}

.ticket-list-item.unread {
    border-left-color: var(--red);
}

.ticket-list-item.medium {
    border-left-color: var(--orange);
}

.ticket-list-item.low {
    border-left-color: var(--green);
}

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

.ticket-title {
    font-weight: 600;
    color: var(--text-dark);
}

.ticket-count {
    font-size: 14px;
    color: var(--text-light);
}

/* QR Scanner */
.scanner-container {
    padding: 40px 20px;
    text-align: center;
}

.scanner-preview {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    margin: 0 auto 32px;
    background: var(--light-gray);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    border: 2px dashed var(--border-gray);
}

.scanner-icon {
    font-size: 64px;
    color: var(--text-light);
}

.scanner-text {
    color: var(--text-light);
    font-size: 16px;
}

.scanner-instruction {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
}

/* Customize Button */
.customize-button {
    padding: 10px 20px;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 0px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
    cursor: pointer;
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 480px) {
    .nav-tiles {
        gap: 8px;
        padding: 16px;
    }

    .nav-tile {
        padding: 20px 12px;
        font-size: 12px;
    }

    .nav-tile i {
        font-size: 28px;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .content-section {
        padding: 16px;
    }
}
