/* SmartWake - Main Stylesheet
 * Created for B20 Conteúdo Digital
 */

/* ---------- Base & Reset ---------- */
:root {
    /* Primary Colors */
    --primary: #2196F3;
    --primary-light: #64B5F6;
    --primary-dark: #1976D2;
    
    /* Secondary Colors */
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;
    --accent: #9C27B0;
    
    /* Neutral Colors */
    --light-bg: #F5F7FA;
    --light-surface: #FFFFFF;
    --light-text: #333333;
    --light-text-secondary: #757575;
    --light-border: #E0E0E0;
    
    --dark-bg: #121212;
    --dark-surface: #1E1E1E;
    --dark-text: #FFFFFF;
    --dark-text-secondary: #B0B0B0;
    --dark-border: #333333;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-dark));
    --gradient-success: linear-gradient(135deg, var(--success), #388E3C);
    --gradient-warning: linear-gradient(135deg, var(--warning), #FFA000);
    --gradient-danger: linear-gradient(135deg, var(--danger), #D32F2F);
    --gradient-accent: linear-gradient(135deg, var(--accent), #7B1FA2);
    
    /* Functional */
    --bg: var(--light-bg);
    --surface: var(--light-surface);
    --text: var(--light-text);
    --text-secondary: var(--light-text-secondary);
    --border: var(--light-border);
    
    /* Sizes */
    --header-height: 60px;
    --footer-height: 50px;
    --border-radius: 12px;
    --btn-border-radius: 8px;
    --input-border-radius: 6px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    
    /* Font */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
    height: 100%;
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.5;
    background-color: var(--bg);
    color: var(--text);
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ---------- Theme Variants ---------- */
.light-theme {
    --bg: var(--light-bg);
    --surface: var(--light-surface);
    --text: var(--light-text);
    --text-secondary: var(--light-text-secondary);
    --border: var(--light-border);
}

.dark-theme {
    --bg: var(--dark-bg);
    --surface: var(--dark-surface);
    --text: var(--dark-text);
    --text-secondary: var(--dark-text-secondary);
    --border: var(--dark-border);
}

/* ---------- Layout & Container ---------- */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.app-header {
    height: var(--header-height);
    background: var(--gradient-primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.app-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.app-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    position: relative;
}

.app-footer {
    height: var(--footer-height);
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.app-footer a {
    color: var(--primary);
    text-decoration: none;
}

.version {
    font-size: 0.7rem;
    margin-top: 0.2rem;
}

/* ---------- View Management ---------- */
.view {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.active-view {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.view-title {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: var(--primary);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--btn-border-radius);
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    outline: none;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: var(--shadow-sm);
}

.primary-btn {
    background: var(--gradient-primary);
    color: white;
}

.secondary-btn {
    background-color: var(--surface);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.warning-btn {
    background: var(--gradient-warning);
    color: var(--light-text);
}

.danger-btn {
    background: var(--gradient-danger);
    color: white;
}

.success-btn {
    background: var(--gradient-success);
    color: white;
}

.large-btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
}

.small-btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

.theme-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color var(--transition-fast);
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

/* ---------- Clock Styles ---------- */
.clock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.analog-clock {
    width: 200px;
    height: 200px;
    position: relative;
    margin-bottom: 1rem;
}

.clock-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    background-color: var(--surface);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.clock-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    margin-top: -6px;
    background-color: var(--primary);
    border-radius: 50%;
    z-index: 10;
}

.hour-hand, .minute-hand, .second-hand {
    position: absolute;
    background-color: var(--text);
    transform-origin: bottom center;
    left: 50%;
    border-radius: 4px;
}

.hour-hand {
    width: 6px;
    height: 60px;
    margin-left: -3px;
    top: 40px;
    background-color: var(--text);
    z-index: 7;
}

.minute-hand {
    width: 4px;
    height: 80px;
    margin-left: -2px;
    top: 20px;
    background-color: var(--primary-dark);
    z-index: 8;
}

.second-hand {
    width: 2px;
    height: 90px;
    margin-left: -1px;
    top: 10px;
    background-color: var(--danger);
    z-index: 9;
}

.clock-marking {
    position: absolute;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

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

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

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

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

.digital-clock {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ---------- Home View ---------- */
.alarm-status, .last-report {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.alarm-status {
    border-left: 4px solid var(--primary);
}

.last-report {
    border-left: 4px solid var(--success);
}

/* ---------- Alarm Settings View ---------- */
.settings-form {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.form-group input[type="time"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--input-border-radius);
    border: 1px solid var(--border);
    background-color: var(--bg);
    color: var(--text);
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

.form-group input[type="time"]:focus,
.form-group select:focus {
    border-color: var(--primary);
    outline: none;
}

.form-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.weekday-selector {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.weekday-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 36px;
    height: 36px;
    cursor: pointer;
}

.weekday-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.weekday-label span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--bg);
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.weekday-label input:checked + span {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

/* ---------- Monitoring View ---------- */
.monitoring-status {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.status-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.status-label {
    font-weight: 600;
    color: var(--text);
}

.status-value {
    font-variant-numeric: tabular-nums;
}

.sensor-status .status-value.active {
    color: var(--success);
    font-weight: 600;
}

.sensor-status .status-value.inactive {
    color: var(--danger);
    font-weight: 600;
}

.monitoring-instructions {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--warning);
}

.monitoring-instructions h3 {
    margin-bottom: 0.75rem;
    color: var(--text);
}

.monitoring-instructions p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.battery-warning {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--danger);
    display: none;
}

.battery-warning.visible {
    display: block;
}

/* ---------- Alarm Ringing View ---------- */
.alarm-ringing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin: 2rem auto;
    max-width: 400px;
}

.alarm-time {
    font-size: 3rem;
    font-weight: 600;
    color: var(--primary);
    margin: 1rem 0;
    font-variant-numeric: tabular-nums;
}

.alarm-message {
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 2rem;
}

/* ---------- Reports View ---------- */
.report-summary, .report-chart, .report-history {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.report-summary h3, .report-chart h3, .report-history h3 {
    margin-bottom: 1rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.summary-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chart-container {
    height: 300px;
    position: relative;
}

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

.history-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

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

.history-date {
    font-weight: 600;
    color: var(--text);
}

.history-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.report-actions {
    display: flex;
    justify-content: space-between;
}

/* ---------- Settings View ---------- */
.settings-list {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

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

.settings-label {
    font-weight: 600;
    color: var(--text);
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: var(--transition-fast);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition-fast);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.faq-section {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.faq-section h3 {
    margin-bottom: 1rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.faq-item {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.faq-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.faq-question {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.faq-answer {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding-left: 1rem;
    border-left: 2px solid var(--primary-light);
}

/* ---------- Responsive Design ---------- */
@media (min-width: 768px) {
    .app-container {
        max-width: 768px;
    }
    
    .action-buttons {
        flex-direction: row;
        justify-content: center;
    }
    
    .form-actions {
        justify-content: center;
        gap: 1rem;
    }
    
    .alarm-ringing-container {
        padding: 3rem;
    }
}

@media (max-width: 480px) {
    .digital-clock {
        font-size: 2rem;
    }
    
    .analog-clock {
        width: 180px;
        height: 180px;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
    }
    
    .weekday-label {
        width: 30px;
        height: 30px;
    }
    
    .weekday-label span {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}

/* ---------- Animations & Transitions ---------- */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse-animation {
    animation: pulse 2s infinite;
}

/* ---------- Utilities ---------- */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
