/* Material Design Variables */
:root {
    --primary-color: #1976d2;
    --primary-dark: #1565c0;
    --primary-light: #42a5f5;
    --accent-color: #ff4081;
    --background-color: #fafafa;
    --surface-color: #ffffff;
    --error-color: #f44336;
    --success-color: #4caf50;
    --text-primary: rgba(0, 0, 0, 0.87);
    --text-secondary: rgba(0, 0, 0, 0.6);
    --text-disabled: rgba(0, 0, 0, 0.38);
    --divider-color: rgba(0, 0, 0, 0.12);
    --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-2: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
    --shadow-3: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
    --border-radius: 4px;
    --transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-2);
    padding: 24px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-3);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* Header */
.app-header {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-welcome {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 16px 12px 8px;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--divider-color);
    border-radius: var(--border-radius);
    background: transparent;
    transition: var(--transition);
    outline: none;
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.input-group label {
    position: absolute;
    top: 16px;
    left: 12px;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: var(--transition);
    pointer-events: none;
    background: var(--surface-color);
    padding: 0 4px;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group input:valid + label,
.input-group textarea:focus + label,
.input-group textarea:not(:placeholder-shown) + label,
.input-group textarea:valid + label {
    top: -8px;
    font-size: 0.75rem;
    color: var(--primary-color);
}

.input-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Checkbox */
.checkbox-group {
    margin: 16px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-size: 0.875rem;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-secondary);
    border-radius: 2px;
    margin-right: 12px;
    position: relative;
    transition: var(--transition);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    outline: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-1);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-2);
}

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

.btn-secondary:hover {
    background-color: rgba(25, 118, 210, 0.04);
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
    box-shadow: var(--shadow-1);
}

.btn-danger:hover {
    background-color: #d32f2f;
    box-shadow: var(--shadow-2);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.admin-btn {
    color: white !important;
    border-color: white !important;
}

.admin-btn:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Text List */
.text-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.text-item {
    background: var(--surface-color);
    border: 1px solid var(--divider-color);
    border-radius: var(--border-radius);
    padding: 16px;
    transition: var(--transition);
}

.text-item:hover {
    box-shadow: var(--shadow-1);
}

.text-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.text-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.text-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.text-content {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
    max-height: 100px;
    overflow: hidden;
}

.text-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.no-texts {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}

/* User List */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--divider-color);
    border-radius: var(--border-radius);
    background: var(--surface-color);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Messages */
.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 8px;
    padding: 8px;
    border-radius: var(--border-radius);
    background-color: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.2);
}

.message {
    font-size: 0.875rem;
    margin-top: 8px;
    padding: 8px;
    border-radius: var(--border-radius);
}

.message.success {
    color: var(--success-color);
    background-color: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.message.error {
    color: var(--error-color);
    background-color: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.2);
}

/* Animations */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }

    .header-content h1 {
        font-size: 1.25rem;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-content {
        padding: 16px;
    }

    .card {
        padding: 16px;
    }

    .text-header {
        flex-direction: column;
        gap: 8px;
    }

    .text-actions {
        justify-content: center;
    }

    .user-item {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .user-actions {
        justify-content: center;
    }

    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 12px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.8rem;
    }

    .main-content {
        padding: 12px;
    }

    .card {
        padding: 12px;
        margin-bottom: 12px;
    }
}