/* Enhanced Styles for PhoneZone Database System */
:root {
    --gold: #d4af37;
    --black: #000000;
    --white: #ffffff;
    --dark-gray: #1a1a1a;
    --light-gray: #f5f5f5;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.15);
    --gradient-gold: linear-gradient(135deg, #d4af37, #f6c84f);
    --gradient-dark: linear-gradient(135deg, #000000, #1a1a1a);
    --gradient-blue: linear-gradient(135deg, #007bff, #0056b3);
    --border-radius: 15px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', 'Sarabun', sans-serif;
    line-height: 1.6;
    color: var(--white);
    background: var(--gradient-dark);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Effects */
.gold-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.05) 0%, transparent 70%);
    z-index: -2;
    animation: floating 20s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% { transform: rotate(0deg) translate(0, 0); }
    33% { transform: rotate(120deg) translate(20px, -20px); }
    66% { transform: rotate(240deg) translate(-20px, 20px); }
}

/* Floating Shapes */
.floating-shapes {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.floating-shapes::before,
.floating-shapes::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(45deg, rgba(212, 175, 55, 0.1), rgba(246, 200, 79, 0.05));
    animation: float 15s linear infinite;
}

.floating-shapes::before {
    width: 300px;
    height: 300px;
    top: 20%;
    left: -150px;
    animation-delay: 0s;
}

.floating-shapes::after {
    width: 200px;
    height: 200px;
    bottom: 20%;
    right: -100px;
    animation-delay: 7s;
}

@keyframes float {
    0% { transform: translateX(0) rotate(0deg); }
    100% { transform: translateX(100vw) rotate(360deg); }
}

/* Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    transition: var(--transition);
}

.navbar.scrolled {
    background: rgba(0, 0, 0, 0.98);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}

.logo img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    transition: var(--transition);
}

.logo:hover img {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.logo h1 {
    color: var(--gold);
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-gold);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.menu {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.menu a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-gold);
    z-index: -1;
    transition: left 0.5s ease;
}

.menu a:hover::before {
    left: 0;
}

.menu a:hover {
    color: var(--black);
    transform: translateY(-2px);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    background: var(--gradient-dark);
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%23d4af37" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    z-index: -1;
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 800;
    background: var(--gradient-gold);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
    text-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
    animation: slideInUp 1s ease-out;
}

.hero p {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 3rem;
    max-width: 600px;
    line-height: 1.8;
    animation: slideInUp 1s ease-out 0.2s both;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Form Containers */
.form-container, .container {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 3rem 2.5rem;
    margin: 2rem auto;
    transition: var(--transition);
    animation: slideInUp 0.8s ease-out;
    position: relative;
    overflow: hidden;
    max-width: 600px;
    width: 90%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Desktop specific styles */
@media (min-width: 768px) {
    .form-container, .container {
        max-width: 600px;
        padding: 4rem 3rem;
    }
}

.form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), transparent);
    z-index: -1;
}

.form-container:hover,
.container:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(212, 175, 55, 0.4);
}

/* Enhanced Headers */
.header h1, h1 {
    color: var(--gold);
    margin: 0 0 2rem 0;
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: 2px;
    text-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
    font-weight: 800;
    background: var(--gradient-gold);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    position: relative;
}

.header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--gradient-gold);
    border-radius: 2px;
}

/* Enhanced Form Groups */
.form-group {
    margin-bottom: 2rem;
    position: relative;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: 0.5rem;
    font-size: 1rem;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid rgba(212, 175, 55, 0.2);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-group input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Enhanced Buttons */
.btn, .submit-button {
    display: inline-block;
    background: var(--gradient-gold);
    color: var(--black);
    padding: 1.2rem 3rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
    position: relative;
    overflow: hidden;
    animation: slideInUp 1s ease-out 0.4s both;
    font-family: inherit;
    letter-spacing: 1px;
    width: 100%;
    margin-top: 2rem;
}

.btn::before, .submit-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f6c84f, #d4af37);
    z-index: -1;
    transition: left 0.5s ease;
}

.btn:hover::before, .submit-button:hover::before {
    left: 0;
}

.btn:hover, .submit-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px rgba(212, 175, 55, 0.4);
}

.btn:active, .submit-button:active {
    transform: translateY(-1px) scale(1.0);
}

.submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Enhanced Tables */
.data-table, table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.data-table th, 
.data-table td,
table th,
table td {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    text-align: left;
    font-size: 1rem;
}

.data-table th,
table th {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(246, 200, 79, 0.1));
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.data-table td,
table td {
    color: var(--white);
    background: rgba(0, 0, 0, 0.3);
}

.data-table tr:nth-child(even) td,
table tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tr:hover td,
table tr:hover td {
    background: rgba(212, 175, 55, 0.1);
    transition: background 0.2s;
}

.data-table td[contenteditable="true"],
table td[contenteditable="true"] {
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.2s;
    cursor: text;
}

.data-table td[contenteditable="true"]:focus,
table td[contenteditable="true"]:focus {
    background: rgba(212, 175, 55, 0.15);
    outline: 2px solid var(--gold);
    border-radius: 8px;
}

/* Enhanced Result Messages */
#result {
    font-size: 1rem;
    margin-top: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    min-height: 30px;
    transition: var(--transition);
    text-align: center;
    padding: 0.8rem;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

#result.success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

#result.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Enhanced Link Styles */
.login-link, .nav {
    text-align: center;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.login-link .submit-button,
.nav .submit-button {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: 2px solid rgba(212, 175, 55, 0.3);
    margin-top: 0;
    width: auto;
    display: inline-block;
    margin: 0;
    padding: 1rem 2rem;
    min-width: 180px;
}

.login-link .submit-button:hover,
.nav .submit-button:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--gold);
}

/* Loading Animation */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-top: 2px solid var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

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

/* Admin Password Input */
input[type="password"]#adminPassword {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 2px solid rgba(212, 175, 55, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    margin-bottom: 1rem;
    transition: var(--transition);
}

input[type="password"]#adminPassword:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* Action Buttons in Tables */
button[onclick*="saveUser"],
button[onclick*="deleteUser"] {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

button[onclick*="saveUser"] {
    background: var(--gradient-gold);
    color: var(--black);
    margin-right: 0.5rem;
}

button[onclick*="saveUser"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

button[onclick*="deleteUser"] {
    background: #ef4444;
    color: var(--white);
}

button[onclick*="deleteUser"]:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-gold);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #f6c84f, #d4af37);
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .menu {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero {
        padding: 8rem 1rem 4rem;
    }
    
    .hero h1 {
        font-size: 3rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .form-container, .container {
        padding: 2rem 1.5rem;
        margin: 1rem;
        max-width: 95%;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .form-group input {
        padding: 0.8rem 1.2rem;
    }
    
    .submit-button, .btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .data-table, table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td,
    table th,
    table td {
        padding: 0.8rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .form-container, .container {
        padding: 1.5rem 1rem;
        margin: 0.5rem;
    }
    
    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-group input {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    .submit-button, .btn {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    .navbar .logo h1 {
        font-size: 1.5rem;
    }
    
    .data-table, table {
        font-size: 0.8rem;
    }
    
    .nav .submit-button {
        width: 100%;
        margin: 0.5rem 0;
    }
}

/* Enhanced animations */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.form-container {
    animation: fadeInScale 0.6s ease-out;
}

/* Success and Error states for forms */
.form-group.success input {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.form-group.error input {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Enhanced focus states */
.submit-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.3);
}

/* Improved table responsiveness */
@media (max-width: 600px) {
    .data-table, table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .data-table thead,
    .data-table tbody,
    .data-table th,
    .data-table td,
    .data-table tr,
    table thead,
    table tbody,
    table th,
    table td,
    table tr {
        display: block;
    }
    
    .data-table thead tr,
    table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .data-table tr,
    table tr {
        border: 1px solid rgba(212, 175, 55, 0.2);
        margin-bottom: 1rem;
        border-radius: 8px;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.05);
    }
    
    .data-table td,
    table td {
        border: none;
        position: relative;
        padding-left: 50%;
        white-space: normal;
        text-align: right;
    }
    
    .data-table td:before,
    table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        color: var(--gold);
        font-weight: 600;
        text-align: left;
    }
}
