@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Roboto:wght@300;400;500&display=swap');

body {
    font-family: 'Roboto', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top to see admin panel when it appears */
    min-height: 100vh;
    margin: 0;
    padding-top: 5vh; /* Add some padding at the top */
    background-color: #1a1a1a; /* Dark charcoal background */
    color: #e0e0e0; /* Light grey text for readability */
    overflow-y: auto; /* Allow scrolling if admin panel is long */
}

.container {
    background-color: #2c2c2c; /* Slightly lighter charcoal for the container */
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 100%;
    max-width: 380px; /* Slightly narrower for a more phone-like keypad feel */
    margin: 20px;
    border: 1px solid #444; /* Subtle border */
}

h1 {
    font-family: 'Playfair Display', serif;
    color: #d4af37; /* Gold accent for titles - a classic barbershop touch */
    margin-bottom: 25px;
    font-size: 2.2em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

form div {
    margin-bottom: 15px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #5f6368;
}

input[type="password"],
input[type="text"],
input[type="url"] {
    width: calc(100% - 22px); /* Account for padding and border */
    padding: 12px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 1.2em;
    text-align: center;
    letter-spacing: 0.3em; /* Spacing for PIN digits */
    box-sizing: border-box;
}

input[type="url"] {
    letter-spacing: normal; /* Normal spacing for URL */
    text-align: left;
}

input[type="password"]::placeholder {
    letter-spacing: normal;
    color: #bdc1c6;
}

/* New Keypad Styles */
#pinDisplay {
    background-color: #1f1f1f; /* Darker background for display */
    border: 1px solid #444;
    border-radius: 8px;
    padding: 18px 15px;
    font-size: 2.2em;
    letter-spacing: 0.3em;
    text-align: center;
    margin-bottom: 30px;
    min-height: 1.5em; 
    color: #e0e0e0; /* Light text on dark display */
    font-family: 'Roboto Mono', monospace; /* Clear monospace for digits/asterisks */
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

#keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px; /* Slightly increased gap */
    margin-bottom: 25px;
}

.keypad-btn {
    background-color: #383838; /* Darker grey for buttons */
    border: 1px solid #555;
    color: #e0e0e0;
    font-size: 1.8em;
    font-weight: 400;
    padding: 22px 0; /* Increased padding for a chunkier feel */
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    user-select: none; 
}

/* This rule should make the zero button span two columns */
.keypad-btn.zero-btn {
    grid-column: span 2;
}

.keypad-btn:active {
    background-color: #d4af37; /* Gold on active */
    color: #1a1a1a;
    transform: scale(0.95);
    box-shadow: none;
}

.keypad-btn.function-btn {
    background-color: #505050; /* Slightly different grey for function keys */
    font-weight: 500;
}

.keypad-btn.function-btn:active {
    background-color: #d4af37; /* Gold on active */
    color: #1a1a1a;
}

/* End New Keypad Styles */

button[type="submit"],
button {
    background-color: #1a73e8;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
    margin-top: 10px;
}

button[type="submit"]:hover,
button:hover {
    background-color: #155ab6;
}

#message {
    margin-top: 20px;
    font-weight: 500;
    min-height: 1.5em; /* Ensure space for messages */
    font-size: 1.1em;
}

.admin-link,
.user-link {
    margin-top: 30px;
    font-size: 0.9em;
}

.admin-link a,
.user-link a {
    color: #1a73e8;
    text-decoration: none;
}

.admin-link a:hover,
.user-link a:hover {
    text-decoration: underline;
}

#currentPins {
    margin-top: 20px;
    text-align: left;
}

#currentPins div {
    background-color: #f8f9fa;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#currentPins div span {
    word-break: break-all;
    margin-right: 10px;
}

#currentPins button {
    background-color: #dc3545; /* Red for delete */
    font-size: 0.9em;
    padding: 8px 12px;
    width: auto;
    margin-top: 0;
}

#currentPins button:hover {
    background-color: #c82333;
}

/* Admin Section Styling */
#adminSection {
    border-top: 2px solid #d4af37; /* Gold separator */
    padding-top: 25px;
    margin-top: 35px;
    background-color: #232323; /* Slightly different bg for admin section */
    border-radius: 0 0 8px 8px; /* Round bottom corners if container has rounded top */
    padding: 20px;
}

#adminSection h2, #adminSection h3 {
    font-family: 'Playfair Display', serif;
    color: #d4af37;
    margin-bottom: 15px;
}

#adminSection h3 {
    font-size: 1.4em;
    margin-top: 20px;
}

#adminSection form div {
    margin-bottom: 18px;
    text-align: left;
}

#adminSection label {
    display: block;
    margin-bottom: 6px;
    font-weight: 400;
    color: #c0c0c0; /* Lighter grey for labels */
}

#adminSection input[type="text"],
#adminSection input[type="url"] {
    width: calc(100% - 24px); 
    padding: 12px;
    border: 1px solid #555;
    border-radius: 6px;
    font-size: 1em;
    background-color: #383838;
    color: #e0e0e0;
    letter-spacing: normal;
    text-align: left;
}

#adminSection button[type="submit"], /* Specifically target admin save button */
#adminSection .admin-delete-btn {
    background-color: #d4af37; /* Gold for primary admin actions */
    color: #1a1a1a; /* Dark text on gold */
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    width: 100%;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#adminSection button[type="submit"]:hover,
#adminSection .admin-delete-btn:hover {
    background-color: #b89b31; /* Darker gold on hover */
    transform: translateY(-1px);
}

/* Styling for dynamically created admin PIN list */
#currentPinsAdmin {
    margin-top: 20px;
    text-align: left;
}

.admin-pin-entry {
    background-color: #383838;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
}

.admin-pin-entry span {
    word-break: break-all;
    margin-right: 10px;
    line-height: 1.4;
}

.admin-delete-btn {
    background-color: #8B0000 !important; /* Dark red for delete - important to override general button */
    color: #e0e0e0 !important;
    font-size: 0.9em !important;
    padding: 8px 12px !important;
    width: auto !important;
    margin-top: 0 !important;
    text-transform: none !important;
}

.admin-delete-btn:hover {
    background-color: #6e0000 !important; /* Darker red on hover */
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    body {
        padding-top: 2vh;
    }
    .container {
        margin: 10px;
        padding: 20px 25px;
        max-width: 90%;
    }

    h1 {
        font-size: 2em;
    }

    #pinDisplay {
        font-size: 1.8em;
        padding: 15px 10px;
    }

    .keypad-btn {
        font-size: 1.6em;
        padding: 18px 0;
    }
    
    #adminSection input[type="text"],
    #adminSection input[type="url"] {
        padding: 10px;
    }

    #adminSection button[type="submit"],
    #adminSection .admin-delete-btn {
        padding: 10px 15px;
    }
}

/* Processing state visual feedback */
.container.processing {
    opacity: 0.8;
    pointer-events: none;
}

.container.processing #keypad::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #d4af37;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

.container.processing #keypad {
    position: relative;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
} 