/* ========================================
   PONTAJ IDEALBRICO - DESIGN MODERN
   Optimizat pentru tablete touch landscape
   ======================================== */

/* === VARIABILE CSS === */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --dark-gradient: linear-gradient(135deg, #434343 0%, #000000 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.15);
    --shadow-strong: 0 15px 50px rgba(0, 0, 0, 0.25);
    --shadow-button: 0 8px 30px rgba(0, 0, 0, 0.3);
    
    --border-radius: 20px;
    --border-radius-small: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === CONTAINER PRINCIPAL === */
.app-container {
    background: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 1000px;
    height: auto;
    max-height: 98vh;
    padding: 15px 25px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* === HEADER === */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.app-header .logo {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.app-header .user-welcome {
    text-align: right;
}

.app-header .user-welcome h2 {
    font-size: 1.8rem;
    color: #333;
    font-weight: 600;
    margin: 0;
}

.app-header .user-welcome .subtitle {
    font-size: 1rem;
    color: #888;
    margin-top: 5px;
}

/* Header centered pentru login */
.app-header.centered {
    flex-direction: column;
    text-align: center;
}

.app-header.centered .logo {
    height: 80px;
    margin-bottom: 15px;
}

.app-header.centered h2 {
    font-size: 1.6rem;
    color: #333;
}

/* === MESAJE ALERT === */
.alert-message {
    padding: 15px 25px;
    border-radius: var(--border-radius-small);
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    animation: slideIn 0.4s ease;
}

.alert-message.success {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.15) 0%, rgba(56, 239, 125, 0.15) 100%);
    color: #0d7d71;
    border: 2px solid #11998e;
}

.alert-message.error {
    background: linear-gradient(135deg, rgba(235, 51, 73, 0.15) 0%, rgba(244, 92, 67, 0.15) 100%);
    color: #c62828;
    border: 2px solid #eb3349;
}

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

/* === CONȚINUT PRINCIPAL === */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

/* === ORA CURENTĂ === */
.current-time {
    text-align: center;
    margin-bottom: 10px;
}

.time-display {
    font-size: 2.8rem;
    font-weight: 700;
    color: #333;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

.date-display {
    font-size: 1rem;
    color: #888;
    margin-top: 3px;
}

/* === BUTOANE PONTAJ (INTRARE/IESIRE) === */
.punch-buttons {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.punch-btn {
    width: 220px;
    height: 130px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 2rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    -webkit-font-smoothing: antialiased;
}

.punch-btn .icon {
    display: none;
}

.punch-btn.entry {
    background: #11998e;
    background: linear-gradient(145deg, #13ab9e 0%, #0d7a71 100%);
}

.punch-btn.exit {
    background: #eb3349;
    background: linear-gradient(145deg, #f04358 0%, #d12a3f 100%);
}

.punch-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.punch-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

/* === BUTON DECONECTARE === */
.logout-section {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.logout-btn {
    background: #434343;
    background: linear-gradient(145deg, #555 0%, #222 100%);
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 60px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

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

/* === ADMIN BUTTONS === */
.admin-section {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #eee;
}

.admin-btn {
    padding: 10px 25px;
    border: none;
    border-radius: var(--border-radius-small);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.admin-btn.primary {
    background: #667eea;
    background: linear-gradient(145deg, #7789f0 0%, #5a6fd6 100%);
    color: white;
}

.admin-btn.danger {
    background: #eb3349;
    background: linear-gradient(145deg, #f04358 0%, #d12a3f 100%);
    color: white;
}

.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* === LOGIN PAGE - KEYBOARD === */
.login-container {
    display: flex;
    gap: 25px;
    align-items: stretch;
    height: 100%;
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 25px;
    border-right: 2px solid #eee;
}

.login-right {
    flex: 1.1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.code-display {
    text-align: center;
    margin-bottom: 15px;
}

.code-display label {
    font-size: 1.1rem;
    color: #555;
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
}

.code-input {
    width: 100%;
    max-width: 260px;
    height: 55px;
    font-size: 2.2rem;
    text-align: center;
    border: 3px solid #667eea;
    border-radius: var(--border-radius-small);
    background: #f8f9ff;
    color: #333;
    letter-spacing: 18px;
    font-weight: 700;
    margin: 0 auto;
    display: block;
}

.code-input:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 5px rgba(102, 126, 234, 0.25);
}

/* Numeric Keyboard */
.keyboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 340px;
    margin: 0 auto;
}

.key {
    height: 58px;
    border: none;
    border-radius: var(--border-radius-small);
    font-size: 1.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #11998e;
    background: linear-gradient(145deg, #13ab9e 0%, #0d7a71 100%);
    color: white;
    box-shadow: 0 3px 12px rgba(17, 153, 142, 0.35);
}

.key:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.4);
}

.key:active, .key.active {
    transform: translateY(0) scale(0.96);
    box-shadow: 0 2px 8px rgba(17, 153, 142, 0.3);
}

.key.delete {
    background: #eb3349;
    background: linear-gradient(145deg, #f04358 0%, #d12a3f 100%);
    box-shadow: 0 3px 12px rgba(235, 51, 73, 0.35);
    font-size: 1rem;
    letter-spacing: 1px;
}

.key.delete:hover {
    box-shadow: 0 6px 20px rgba(235, 51, 73, 0.4);
}

.key.zero {
    grid-column: span 2;
}

/* === ADMIN PANEL === */
.admin-container {
    display: flex;
    gap: 35px;
    height: 100%;
    overflow: hidden;
}

.admin-form-section {
    flex: 1;
    background: #f8f9ff;
    border-radius: var(--border-radius);
    padding: 25px;
    overflow-y: auto;
}

.admin-users-section {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-title {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 3px solid #667eea;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.form-group label {
    display: block;
    font-size: 1rem;
    color: #555;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    height: 55px;
    padding: 12px 18px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius-small);
    font-size: 1.1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.form-control.select {
    cursor: pointer;
    background: white;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.btn-submit {
    width: 100%;
    height: 60px;
    border: none;
    border-radius: var(--border-radius-small);
    background: var(--primary-gradient);
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 15px;
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
}

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

/* User List */
.user-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.user-card {
    background: white;
    border-radius: var(--border-radius-small);
    padding: 20px 25px;
    margin-bottom: 15px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.user-card:hover {
    transform: translateX(8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 18px;
}

.user-avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
}

.user-details h4 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 4px;
}

.user-details .role {
    font-size: 0.9rem;
    color: #888;
    text-transform: capitalize;
}

.user-details .role.admin {
    color: #667eea;
    font-weight: 600;
}

.user-actions {
    display: flex;
    gap: 12px;
}

.btn-action {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-action.export {
    background: var(--info-gradient);
    color: white;
}

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

.btn-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Back button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: var(--dark-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius-small);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    margin-bottom: 20px;
}

.back-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
    color: white;
}

/* === SCROLLBAR CUSTOM === */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5a6fd6, #6a4190);
}

/* === RESPONSIVE - LANDSCAPE TABLET === */
@media (max-width: 1024px) and (orientation: landscape) {
    body {
        padding: 15px;
    }
    
    .app-container {
        padding: 20px 30px;
        max-height: 95vh;
    }
    
    .app-header .logo {
        height: 55px;
    }
    
    .app-header .user-welcome h2 {
        font-size: 1.5rem;
    }
    
    .time-display {
        font-size: 3rem;
    }
    
    .punch-btn {
        width: 250px;
        height: 160px;
        font-size: 2.2rem;
    }
    
    .punch-btn .icon {
        font-size: 2.8rem;
    }
    
    .logout-btn {
        padding: 18px 70px;
        font-size: 1.4rem;
    }
    
    .key {
        height: 75px;
        font-size: 1.8rem;
    }
    
    .code-input {
        height: 65px;
        font-size: 2.5rem;
    }
    
    .login-container {
        gap: 35px;
    }
    
    .login-left {
        padding-right: 35px;
    }
}

@media (max-width: 800px) and (orientation: landscape) {
    .punch-btn {
        width: 200px;
        height: 140px;
        font-size: 1.8rem;
        gap: 10px;
    }
    
    .punch-btn .icon {
        font-size: 2.2rem;
    }
    
    .key {
        height: 65px;
        font-size: 1.6rem;
    }
    
    .keyboard {
        gap: 10px;
        max-width: 350px;
    }
    
    .time-display {
        font-size: 2.5rem;
    }
}

/* === ANIMAȚII PENTRU TOUCH FEEDBACK === */
@keyframes touchPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.touch-feedback {
    animation: touchPulse 0.15s ease;
}

/* === PORTRAIT RECOMMENDATION BANNER === */
.portrait-recommendation {
    display: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-size: 0.95rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.portrait-recommendation .message {
    display: flex;
    align-items: center;
    gap: 10px;
}

.portrait-recommendation .rotate-icon {
    font-size: 1.3rem;
    animation: gentleRotate 2s ease-in-out infinite;
}

@keyframes gentleRotate {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(15deg); }
}

.portrait-recommendation .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.portrait-recommendation .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Afișează banner-ul doar în portrait și dacă nu a fost închis */
@media (orientation: portrait) {
    .portrait-recommendation:not(.dismissed) {
        display: flex;
    }
    
    /* Ajustează container-ul când banner-ul e vizibil */
    body:has(.portrait-recommendation:not(.dismissed)) .app-container {
        margin-top: 60px;
        max-height: calc(100vh - 80px);
    }
}

/* === RESPONSIVE PORTRAIT MODE === */
@media (orientation: portrait) {
    body {
        padding: 15px;
    }
    
    .app-container {
        padding: 20px;
        max-height: none;
        height: auto;
        min-height: calc(100vh - 30px);
    }
    
    html, body {
        height: auto;
        overflow: auto;
    }
    
    .app-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .app-header .user-welcome {
        text-align: center;
    }
    
    .punch-buttons {
        flex-direction: column;
        gap: 20px;
    }
    
    .punch-btn {
        width: 100%;
        max-width: 350px;
        height: 140px;
        font-size: 2rem;
    }
    
    .punch-btn .icon {
        font-size: 2.5rem;
    }
    
    .logout-btn {
        width: 100%;
        max-width: 350px;
        padding: 18px 40px;
        font-size: 1.3rem;
    }
    
    .logout-section {
        display: flex;
        justify-content: center;
    }
    
    .admin-section {
        flex-direction: column;
        align-items: center;
    }
    
    .admin-btn {
        width: 100%;
        max-width: 350px;
        justify-content: center;
    }
    
    /* Login page portrait */
    .login-container {
        flex-direction: column;
        gap: 30px;
    }
    
    .login-left {
        padding-right: 0;
        border-right: none;
        border-bottom: 2px solid #eee;
        padding-bottom: 25px;
    }
    
    .keyboard {
        max-width: 100%;
    }
    
    .key {
        height: 70px;
        font-size: 1.8rem;
    }
    
    .code-input {
        max-width: 100%;
        height: 65px;
        font-size: 2.2rem;
        letter-spacing: 12px;
    }
    
    .time-display {
        font-size: 2.5rem;
    }
    
    .current-time {
        margin-bottom: 20px;
    }
    
    /* Admin panel portrait */
    .admin-container {
        flex-direction: column;
        overflow: visible;
    }
    
    .admin-form-section,
    .admin-users-section {
        flex: none;
    }
    
    .user-card {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .user-info {
        flex-direction: column;
    }
    
    .user-actions {
        width: 100%;
        justify-content: center;
    }
}
