body {
    font-family: sans-serif;
    margin: 0;
    background: #f4f4f4;
    color: #333;
}

header {
    background: #222;
    color: #fff;
    padding: 1rem;
    text-align: center;
    position: relative;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
}

/* Header Actions & Icons */
.header-actions {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transition: background 0.2s;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.1);
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.header-pill-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.9;
    transition: opacity 0.2s, background 0.2s;
    padding: 0.5rem 0.8rem;
    border-radius: 20px; /* Pill shape */
    background: rgba(255,255,255,0.05);
}

.header-pill-btn:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

@media (max-width: 600px) {
    .header-actions {
        position: static;
        margin-top: 1rem;
        justify-content: center;
        transform: none;
    }
}

main {
    padding: 1rem;
}

section {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    max-width: 1180px;
    margin: 0 auto;
}

h2 {
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
    margin-top: 0;
}

/* Buttons and Links */
.btn-text {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.btn-text:hover {
    color: #222;
    text-decoration: underline;
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 3rem auto;
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.login-container input {
    display: block;
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.login-container button {
    width: 100%;
    background: #222;
    color: #fff;
    padding: 0.8rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

/* Month Selector Modern Design */
.month-selector-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
}

.month-selector-form {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.selector-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.selector-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
}

.styled-select {
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    min-width: 140px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem top 50%;
    background-size: 0.65rem auto;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.styled-select:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 0.2rem rgba(0,0,0,.25);
}

/* Agenda Grid */
.calendario-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: transparent;
    padding: 0.5rem 0;
    text-align: center;
    font-weight: bold;
    border-radius: 4px;
    margin-bottom: 5px;
}

.calendario {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-top: 5px;
}

.dia {
    background: #fff;
    border: 1px solid #ddd;
    min-height: 80px;
    padding: 5px;
    position: relative;
    border-radius: 4px;
}

.dia.vazio {
    background: #f9f9f9;
    border: none;
}

.dia.passado {
    background: #ef9a9a;
    color: #555;
    border-color: #ef5350;
}

.dia.disponivel {
    background: #a5d6a7;
    border-color: #66bb6a;
    cursor: pointer;
}
.dia.disponivel:hover {
    background: #81c784;
    border-color: #2e7d32;
}

.dia.ocupado {
    background: #ef9a9a;
    border-color: #ef5350;
}

/* Modal */
.modal {
    display: none;
    position: fixed; 
    z-index: 999; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5); 
}
.modal-content {
    background-color: #fefefe;
    margin: 15% auto; 
    padding: 1.5rem;
    border: none;
    width: 90%;
    max-width: 350px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: center;
}
.fechar {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.fechar:hover, .fechar:focus {
    color: black;
    text-decoration: none;
}

#lista-horarios {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
}
.horario-item {
    padding: 10px;
    background: #f9f9f9;
    margin-bottom: 5px;
    border: 1px solid #eee;
    border-radius: 4px;
    text-align: center;
}
.horario-item:hover {
    background: #e0e0e0;
}
.horario-selecionado {
    background: #222 !important;
    color: white;
}
.sem {
    text-align: center;
    color: #777;
    padding: 1rem;
}

.btn-voltar {
    display: inline-block;
    margin-top: 1rem;
    text-decoration: none;
    background: #666;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}
.erro {
    color: red;
    background: #ffe6e6;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    text-align: center;
}

/* Painel Barbeiro */
.appointments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.appointment-card {
    background: #fff;
    border-left: 4px solid #4caf50;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.appointment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

.appointment-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.appointment-info .time {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
}

.appointment-info .client-name {
    color: #555;
    font-weight: 500;
}

.appointment-info .client-phone {
    font-size: 0.85rem;
    color: #888;
}

.appointment-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.tag-service {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-icon {
    font-size: 1.2rem;
}

.btn {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-primary {
    background-color: #222;
    color: #fff;
    border: 1px solid #222;
}
.btn-primary:hover {
    background-color: #000;
    border-color: #000;
}
.btn-primary:disabled {
    background-color: #555;
    border-color: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
    border: 1px solid #ccc;
}
.btn-secondary:hover {
    background-color: #d0d0d0;
    border-color: #bbb;
}

/* Settings & Forms */
.settings-container {
    max-width: 600px;
    margin: 2rem auto;
}

.settings-card {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.settings-card h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    color: #222;
}

.form-grid {
    display: grid;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.form-group label {
    font-weight: 500;
    font-size: 0.95rem;
    color: #444;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fdfdfd;
}

.form-control:focus {
    outline: none;
    border-color: #222;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.12);
}

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

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    line-height: 1.5;
    border-radius: 6px;
}

/* Professional Button Theme */
.btn-primary {
    color: #fff;
    background-color: #222;
    border-color: #222;
}
.btn-primary:hover {
    background-color: #000;
    border-color: #000;
}

.btn-success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}
.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}
.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-block {
    width: 100%;
    margin-top: 1rem;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .settings-container {
        margin: 1rem;
    }
}

/* Slot Card Styles (Recovered & Expanded) */
.slot-card {
    background: #fff;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.8rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

/* Booked Slot Style */
.slot-card.booked {
    border: 1px solid #4caf50; /* Green border to indicate confirmed booking */
    background: #f9fff9;
}

.slot-card.booked::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #4caf50;
}

.badge-booked {
    background: #4caf50;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: auto;
}

.slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slot-time {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.available { background-color: #4caf50; }
.status-dot.unavailable { background-color: #f44336; }

.slot-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover { background-color: #f0f0f0; }
.icon-btn.edit:hover { color: #2196f3; background-color: #e3f2fd; }
.icon-btn.activate:hover { color: #4caf50; background-color: #e8f5e9; }
.icon-btn.delete:hover { color: #f44336; background-color: #ffebee; }
.icon-btn.release:hover { color: #ff9800; background-color: #fff3e0; }

.horarios-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}
.lista-horarios-admin {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

/* Back Button Icon (Circular with White Arrow) */
.btn-back-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: #222;
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.btn-back-icon:hover {
    background-color: #000;
    transform: translateX(-3px);
    color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Success Modal Buttons */
.btn-whatsapp-confirm {
    background: #25D366;
    color: #fff;
    padding: 0.8rem 2rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1rem;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 200px;
    display: inline-flex;
}

.btn-modal-close {
    background: #222;
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
}

/* Mobile & Responsive Adaptations */
@media (max-width: 768px) {
    /* Global Container Adjustments */
    section {
        padding: 1rem;
        margin: 0.5rem;
        width: auto;
        border-radius: 8px;
    }
    
    main {
        padding: 0.5rem;
    }

    /* Typography Improvements for Mobile */
    body {
        font-size: 16px; /* Base size for readability */
        line-height: 1.5;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    p, label, li { font-size: 1rem; }

    /* Header Adjustments */
    header {
        padding: 0.8rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .header-actions {
        position: static;
        transform: none;
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }

    /* Form Elements & Inputs - Touch Friendly */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="tel"],
    select, 
    button, 
    .btn,
    .styled-select {
        min-height: 48px; /* Easier to tap */
        font-size: 1rem;
    }

    /* Stack Forms */
    .month-selector-form {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .styled-select {
        width: 100%;
    }

    /* Calendar Grid for Small Screens */
    .calendario {
        gap: 2px;
    }
    
    .dia {
        min-height: 60px;
        padding: 2px;
        font-size: 0.8rem;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }
    
    .calendario-header {
        font-size: 0.8rem;
    }

    /* Login & Card Containers */
    .login-container {
        width: auto;
        margin: 1rem;
        padding: 1.5rem;
    }

    /* Button Full Width on Mobile */
    .btn-full-mobile, 
    form button[type="submit"],
    .login-container button,
    .btn-whatsapp-confirm,
    .btn-modal-close {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 0.5rem;
        box-sizing: border-box;
    }
    
    /* Admin Grid Adjustments */
    .appointments-grid {
        grid-template-columns: 1fr; /* 1 column */
    }
    
    .horarios-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .lista-horarios-admin {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (max-width: 480px) {
    /* Extra adjustments for very small screens */
    .header-pill-btn {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .icon-button {
        width: 40px;
        height: 40px; /* Larger touch target */
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .dia {
        min-height: 50px;
    }
}