/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.section {
    width: 100%;
    max-width: 1200px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Login Section */
.login-box {
    padding: 60px;
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.login-box h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #4a5568;
}

.subtitle {
    color: #718096;
    margin-bottom: 40px;
    font-size: 1rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 25px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

/* App Header */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.8rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Status Bar */
.status-bar {
    background: #f7fafc;
    padding: 15px 40px;
    display: flex;
    gap: 30px;
    border-bottom: 1px solid #e2e8f0;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4a5568;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.connected {
    background: #48bb78;
}

.status-dot.disconnected {
    background: #f56565;
}

/* Main Content */
.app-main {
    padding: 40px;
}

.transfer-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.transfer-box {
    background: #f7fafc;
    border-radius: 15px;
    padding: 25px;
    border: 2px solid #e2e8f0;
}

.transfer-box h3 {
    margin-bottom: 20px;
    color: #4a5568;
    font-size: 1.2rem;
}

.transfer-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.character-counter {
    text-align: right;
    font-size: 12px;
    color: #718096;
    margin-top: 5px;
}

.text-display {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    min-height: 120px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
}

.text-display .placeholder {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.received-info {
    margin-top: 10px;
    text-align: right;
    color: #718096;
}

/* Improved received content layout */
.received-content {
    position: relative;
}

.received-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 15px;
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.received-text-container {
    position: relative;
}

.copy-button-top {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(72, 187, 120, 0.95);
    backdrop-filter: blur(5px);
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.copy-button-top:hover {
    background: rgba(56, 178, 172, 0.95);
    transform: translateY(-1px);
}

/* Text display with proper padding for top button */
.text-display.has-copy-button {
    padding-top: 45px;
}

/* History Section */
.history-section {
    background: #f7fafc;
    border-radius: 15px;
    padding: 25px;
    border: 2px solid #e2e8f0;
}

.history-section h3 {
    margin-bottom: 20px;
    color: #4a5568;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.history-item .content-preview {
    font-family: 'Consolas', 'Monaco', monospace;
    color: #4a5568;
    margin-bottom: 5px;
}

.history-item .meta {
    font-size: 12px;
    color: #718096;
    display: flex;
    justify-content: space-between;
}

/* Admin Styles */
.admin-main {
    padding: 0;
}

.admin-nav {
    background: #f7fafc;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 40px;
    display: flex;
    gap: 5px;
}

.nav-btn {
    background: transparent;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    color: #718096;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-btn:hover,
.nav-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.admin-content {
    padding: 40px;
}

.admin-tab {
    display: none;
}

.admin-tab.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.tab-header h3 {
    color: #4a5568;
    font-size: 1.5rem;
}

.controls {
    display: flex;
    gap: 10px;
}

/* Data Table */
.data-table {
    background: white;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
    overflow: hidden;
    width: 100%;
}

/* HTML Table Styles */
.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.data-table td {
    color: #2d3748;
    font-size: 14px;
}

.data-table tr:hover {
    background: #f7fafc;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Legacy Grid Table Styles (for transfers table) */
.table-header {
    background: #f7fafc;
    padding: 15px 20px;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
    display: grid;
    gap: 20px;
}

.table-row {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: grid;
    gap: 20px;
    align-items: center;
    transition: background-color 0.3s ease;
}

.table-row:hover {
    background: #f7fafc;
}

.table-row:last-child {
    border-bottom: none;
}

/* User Table */
.users-table-header,
.users-table-row {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
}

/* Transfer Table */
.transfers-table-header,
.transfers-table-row {
    grid-template-columns: 1fr 3fr 1fr 1fr 1fr auto;
}

.table-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
}

.table-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.table-actions .btn-secondary {
    background: #667eea;
    color: white;
}

.table-actions .btn-secondary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.table-actions .btn-danger {
    background: #f56565;
    color: white;
}

.table-actions .btn-danger:hover {
    background: #e53e3e;
    transform: translateY(-1px);
}

/* Settings List */
.settings-list {
    background: white;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
    overflow: hidden;
}

.setting-item {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 20px;
    align-items: center;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info h4 {
    color: #4a5568;
    margin-bottom: 5px;
}

.setting-info p {
    color: #718096;
    font-size: 14px;
}

.setting-value {
    font-family: 'Consolas', 'Monaco', monospace;
    background: #f7fafc;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* Stats Content */
.stats-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    border: 2px solid #e2e8f0;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-card .stat-label {
    color: #718096;
    font-size: 14px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    color: #4a5568;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Error Message */
.error-message {
    background: #fed7d7;
    color: #9b2c2c;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #feb2b2;
}

.success-message {
    background: #c6f6d5;
    color: #276749;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #9ae6b4;
}

/* Badge Styles */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #c6f6d5;
    color: #276749;
}

.badge-danger {
    background: #fed7d7;
    color: #9b2c2c;
}

.badge-warning {
    background: #fefcbf;
    color: #744210;
}

.badge-info {
    background: #bee3f8;
    color: #2a69ac;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .login-box {
        padding: 40px 30px;
    }
    
    .app-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .app-main,
    .admin-content {
        padding: 20px;
    }
    
    .transfer-area {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .status-bar {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .admin-nav {
        padding: 0 20px;
    }
    
    /* Responsive improvements for history view buttons */
    .history-item-actions {
        position: static;
        opacity: 1;
        margin-top: 10px;
        text-align: right;
    }
    
    .transfer-modal {
        margin: 20px;
        max-width: calc(100vw - 40px);
    }
    
    .data-table {
        overflow-x: auto;
    }
    
    .users-table-header,
    .users-table-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .transfers-table-header,
    .transfers-table-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .setting-item {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
    }
    
    .stats-content {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Transfer View Modal */
.transfer-modal {
    max-width: 800px;
    max-height: 90vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.transfer-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.meta-item strong {
    color: #4a5568;
}

.transfer-content-container {
    position: relative;
}

.transfer-actions-top {
    margin-bottom: 10px;
    text-align: right;
}

.transfer-content-display {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.5;
}

/* History item improvements */
.history-item {
    position: relative;
}

.history-item-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.history-item:hover .history-item-actions {
    opacity: 1;
}

.history-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Search Panel Styles */
.search-panel {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.search-row:last-child {
    margin-bottom: 0;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 200px;
}

.search-field label {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.search-field input,
.search-field select {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.search-field input:focus,
.search-field select:focus {
    outline: none;
    border-color: #667eea;
}

.search-actions {
    display: flex;
    gap: 10px;
    align-items: end;
    padding-bottom: 2px;
}

/* Results Info Bar */
.results-info {
    background: #edf2f7;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px 0;
    border-top: 2px solid #e2e8f0;
}

.pagination-info {
    color: #718096;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-btn {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.pagination-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn:disabled:hover {
    border-color: #e2e8f0;
    background: white;
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: #a0aec0;
    font-size: 14px;
}

/* Enhanced Transfer Table Styles */
.user-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-cell strong {
    color: #4a5568;
    font-size: 14px;
}

.user-cell small {
    color: #a0aec0;
    font-size: 11px;
}

.date-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.date-cell div {
    font-weight: 500;
    color: #4a5568;
}

.date-cell small {
    color: #718096;
    font-size: 11px;
}

.size-badge {
    font-weight: 600;
    color: #667eea;
    font-size: 14px;
}

.content-preview {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    background: #f7fafc;
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #e2e8f0;
    cursor: help;
}

.transfers-table-header {
    background: #667eea;
    color: white;
    font-weight: 600;
    font-size: 13px;
}

.transfers-table-row:hover {
    background: #f8fafc;
    transform: translateX(2px);
}

.badge-info {
    background: #3182ce;
    color: white;
}

.badge-success {
    background: #38a169;
    color: white;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.hidden { display: none !important; }
.visible { display: block !important; }